Alternate port connection fails: Keyword not supported: 'port'.
Posted by: Jeff Woods
Date: May 12, 2014 10:07AM

Hello All,

This is driving me nuts.

I have a databound custom control, connecting to a remote MySQL server running on an alternate port. I have created a connection and bound it to the control. The connection is visible in VS 2013's Server Explorer panel, and works there. I can connect, drill down to the table details, "retrieve data", everything. The connection string WORKS.... until the databound control tries to hit it.

When I load the web page from VS2013 in a browser (F5), I get:


Server Error in '/' Application.

Keyword not supported: 'port'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Keyword not supported: 'port'.

Source Error:


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:



[ArgumentException: Keyword not supported: 'port'.]
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +4923292
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +55
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +200
System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +62
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
System.Web.UI.WebControls.SqlDataSource.CreateConnection(String connectionString) +29
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +89
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +19
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.WebControls.DetailsView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.DetailsView.EnsureDataBound() +184
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +72
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +44
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


----

This stack trace confuses me, because it is referencing the standard System.Data.SqlClient assembly, rather than the MySQL provider. I have ZERO references to System.Data in my web page, as confirmed by Search Entire Solution.

Interestingly, if I change the connection string to this:

server=go.itelescope.net;prot=3307;user id=XXXXXXXX;password=XXXXX;persistsecurityinfo=True;database=dev

... in which I intentionally misspelled "port" as "prot", and make NO OTHER CHANGES, the error and stack trace becomes this:


Server Error in '/' Application.

Keyword not supported.
Parameter name: prot
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Keyword not supported.
Parameter name: prot

Source Error:



Line 22: Calendar1.SelectedDates.Add(selected);
Line 23: }
Line 24: DayPilotCalendar1.DataBind();
Line 25: }
Line 26: }


Source File: d:\Users\ADB Jester\Projects\Reservations Pilot\ReservationsPilot\Default.aspx.cs Line: 24

Stack Trace:



[ArgumentException: Keyword not supported.
Parameter name: prot]
MySql.Data.MySqlClient.MySqlConnectionStringBuilder.GetOption(String key) +118
MySql.Data.MySqlClient.MySqlConnectionStringBuilder.set_Item(String keyword, Object value) +42
System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value) +181
MySql.Data.MySqlClient.MySqlConnectionStringBuilder..ctor(String connStr) +137
MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(String value) +336
System.Web.UI.WebControls.SqlDataSource.CreateConnection(String connectionString) +29
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +89
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +19
DayPilot.Web.Ui.DayPilotCalendar.PerformSelect() +128
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
Database_Default.Page_Load(Object sender, EventArgs e) in d:\Users\ADB Jester\Projects\Reservations Pilot\ReservationsPilot\Default.aspx.cs:24
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


------

*NOW* it is referencing the MySQL.Data assembly, and correctly recognizing that "prot" is not a valid parameter. It is even identifying the point of error correctly (at the point of databinding), whereas before it didn't get that far.

Why is it, then, that with no references to System.Data, the use of a perfectly acceptable parameter name causes the system to go "off track" and look at the wrong assembly and fail, rather than allowing MySQL to use the valid port parameter?

I'm stumped!

Here are the guts:

web.config:

<connectionStrings>
<add name="devConnectionString" connectionString="server=go.itelescope.net;port=3307;user id=xxxxxxxx;password=xxxxx;persistsecurityinfo=True;database=dev"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>

<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
</assemblies>

---------------

Default.aspx:

<asp:UpdatePanel ID="UpdatePanelCalendar" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<DayPilot:DayPilotCalendar ID="DayPilotCalendar1" runat="server"

<!-- lots of control-specific tags & event wireups removed for brevity -->

CellSelectColor="#316AC5" DataSourceID="MySqlDataSourcePilot"
</DayPilot:DayPilotCalendar>
<asp:SqlDataSource ID="MySqlDataSourcePilot" runat="server" ConnectionString="<%$ ConnectionStrings:devConnectionString %>" ProviderName="<%$ ConnectionStrings:devConnectionString.ProviderName %>"
SelectCommand="SELECT id, Username, TSystem, Start_Time, End_Time, Deleted, Notes, Plan_To_Run, All_Day FROM dev.reservations Where Deleted = 'No' and TSystem ='GRAS005'">
<SelectParameters>
<asp:ControlParameter Name="start" ControlID="DayPilotCalendar1" PropertyName="StartDate" />
<asp:ControlParameter Name="end" ControlID="DayPilotCalendar1" PropertyName="EndDate" />
</SelectParameters>
</asp:SqlDataSource>
</ContentTemplate>
</asp:UpdatePanel>

------------------------------

and from default.aspx.cs:

using System;
using System.Configuration;
using System.Web.UI.WebControls;
using DayPilot.Web.Ui.Events;
using MySql.Data.MySqlClient;

public partial class Database_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// prevent invalid ViewState errors in Firefox
if (Request.Browser.Browser == "Firefox") Response.Cache.SetNoStore();

if (!IsPostBack)
{
DayPilotCalendar1.StartDate = DayPilot.Utils.Week.FirstDayOfWeek();

// select full week in the Calendar control
for (int i = 0; i < 7; i++)
{
DateTime selected = DayPilotCalendar1.StartDate.AddDays(i);
Calendar1.SelectedDates.Add(selected);
}
DayPilotCalendar1.DataBind();
}
}

Any help would be appreciated. Thanks!

Jeff Woods
Reading, PA

Options: ReplyQuote


Subject
Written By
Posted
Alternate port connection fails: Keyword not supported: 'port'.
May 12, 2014 10:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.