Dinglemeyer Dinglemeyer - 4 months ago 70
MySQL Question

Getting error: "Unable to connect to any of the specified MySQL hosts." In an application that doesn't use MySQL

We're migrating a series of applications from older servers to new servers.

After testing this application successfully in our new DEV server and then promoting the code to the new PROD server, this is returning an error. After checking the database code in this application, I am certain we're using SQL Server and not MySQL... I'm a little puzzled as to why this would occur. Any ideas or suggestions?

EDIT: I got an administrator of our server to view this error from the local machine and this is what is really being returned, specifically having to do with the sitemap providers listed on the machine.config on the server...


Server Error in '/DinglemeyersApplication' Application.




Configuration Error

Description: An error occurred during the processing of a
configuration file required to service this request. Please review the
specific error details below and modify your configuration file
appropriately.

Parser Error Message: Unable to connect to any of the specified MySQL
hosts.

Source Error:


Line 274: <siteMap>
Line 275: <providers>
Line 276: <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web,
Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
connectionStringName="LocalMySqlServer" applicationName="/" />
Line 277: </providers>
Line 278: </siteMap>



Source File:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
Line: 276
________________________________________ Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1069.1


Digging deeper to a file system log, I find the full stack trace is as follows:


System.Configuration.ConfigurationErrorsException: Unable to connect
to any of the specified MySQL hosts.
(C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
line 276) ---> MySql.Data.MySqlClient.MySqlException: Unable to
connect to any of the specified MySQL hosts. at
MySql.Data.MySqlClient.NativeDriver.Open() at
MySql.Data.MySqlClient.Driver.Open() at
MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder
settings) at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() at
MySql.Data.MySqlClient.MySqlPool.GetConnection() at
MySql.Data.MySqlClient.MySqlConnection.Open() at
MySql.Web.Common.SchemaManager.GetSchemaVersion(String
connectionString) at
MySql.Web.Common.SchemaManager.CheckSchema(String connectionString,
NameValueCollection config) at
System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings
providerSettings, Type providerType) --- End of inner exception
stack trace --- at
System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings
providerSettings, Type providerType) at
System.Web.Configuration.ProvidersHelper.InstantiateProviders(ProviderSettingsCollection
configProviders, ProviderCollection providers, Type providerType)

at System.Web.Configuration.SiteMapSection.get_ProvidersInternal()

at System.Web.SiteMap.Initialize() at
System.Web.UI.WebControls.SiteMapDataSource.get_Provider() at
System.Web.UI.WebControls.SiteMapDataSource.GetHierarchicalView(String
viewPath) at
System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData(String
viewPath) at System.Web.UI.WebControls.Menu.DataBindItem(MenuItem
item) at System.Web.UI.WebControls.Menu.PerformDataBinding() at
System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()

at System.Web.UI.WebControls.Menu.EnsureDataBound() at
System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e) at
System.Web.UI.Control.PreRenderRecursiveInternal() at
System.Web.UI.Control.PreRenderRecursiveInternal() at
System.Web.UI.Control.PreRenderRecursiveInternal() at
System.Web.UI.Control.PreRenderRecursiveInternal() at
System.Web.UI.Control.PreRenderRecursiveInternal() at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

at System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

at System.Web.UI.Page.ProcessRequest() at
System.Web.UI.Page.ProcessRequest(HttpContext context) at
ASP.default_aspx.ProcessRequest(HttpContext context) in
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET
Files\dinglemeyersApplication\faeebe62\5126d38e\App_Web_fi2tylhk.5.cs:line 0
at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)

Answer

I've resolved this problem using the approach described in StackOverflow post:

ASP.NET Cannot Find MySQL Host Even Though I'm Not Using MySQL

Previously this application didn't have any sitemap defined in the web.config. By going into my web.config and adding a sitemap node, and then adding a <remove name="MySqlSiteMapProvider"> this has seemed to resolve the issue. I will continue to test the application after this migration, but now it's working!

in my web.config:

<system.web>
 ...
  <siteMap>
    <providers>   
        <remove name="MySqlSiteMapProvider" />
    </providers>
  </siteMap>
</system.web>
Comments