收到错误消息:“无法连接到任何指定的MySQL主机."在不使用MySQL的应用程序中
我们正在将一系列应用程序从旧服务器迁移到新服务器.
We're migrating a series of applications from older servers to new servers.
在我们的新DEV服务器中成功测试了该应用程序,然后将代码升级到新的PROD服务器之后,这将返回错误.在检查了此应用程序中的数据库代码之后,我确定我们正在使用SQL Server而不是MySQL.有什么想法或建议吗?
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?
我有一个服务器管理员来从本地计算机查看此错误,而这实际上是返回的内容,特别是与服务器上machine.config上列出的站点地图提供程序有关的问题.
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...
'/DinglemeyersApplication'应用程序中的服务器错误.
配置错误
说明:在处理服务此请求所需的配置文件.请查看下面的特定错误详细信息并修改您的配置文件适当地.
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.
解析器错误消息:无法连接到任何指定的MySQL主机.
Parser Error Message: Unable to connect to any of the specified MySQL hosts.
源错误:
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>
源文件:C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ Config \ machine.config线:276________________________________________版本信息:Microsoft .NET Framework版本:4.0.30319;ASP.NET版本:4.6.1069.1
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:无法连接到任何指定的MySQL主机.(C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ Config \ machine.config第276行)---> MySql.Data.MySqlClient.MySqlException:无法连接到任何指定的MySQL主机.在MySql.Data.MySqlClient.NativeDriver.Open()在MySql.Data.MySqlClient.Driver.Open()在MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder设置)在MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()在MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()在MySql.Data.MySqlClient.MySqlPool.GetConnection()在MySql.Data.MySqlClient.MySqlConnection.Open()在MySql.Web.Common.SchemaManager.GetSchemaVersion(StringconnectionString)在MySql.Web.Common.SchemaManager.CheckSchema(String connectionString,NameValueCollection配置)位于System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettingsproviderSettings,类型providerType)-内部异常结束堆栈跟踪---System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettingsproviderSettings,键入providerType),位于System.Web.Configuration.ProvidersHelper.InstantiateProviders(ProviderSettingsCollectionconfigProviders,ProviderCollection提供程序,类型providerType)
在System.Web.Configuration.SiteMapSection.get_ProvidersInternal()
在System.Web.SiteMap.Initialize()处System.Web.UI.WebControls.SiteMapDataSource.get_Provider()在System.Web.UI.WebControls.SiteMapDataSource.GetHierarchicalView(StringviewPath)System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData(StringSystem.Web.UI.WebControls.Menu.DataBindItem(MenuItem)上的viewPath)item)在System.Web.UI.WebControls.Menu.PerformDataBinding()在System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect()在System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()处
在System.Web.UI.WebControls.Menu.EnsureDataBound()在System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e)在System.Web.UI.Control.PreRenderRecursiveInternal()在System.Web.UI.Control.PreRenderRecursiveInternal()在System.Web.UI.Control.PreRenderRecursiveInternal()在System.Web.UI.Control.PreRenderRecursiveInternal()在System.Web.UI.Control.PreRenderRecursiveInternal()在System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔值includeStagesAfterAsyncPoint)
在System.Web.UI.Page.ProcessRequest(布尔includeStagesBeforeAsyncPoint,布尔值includeStagesAfterAsyncPoint)
在System.Web.UI.Page.ProcessRequest()处System.Web.UI.Page.ProcessRequest(HttpContext上下文)位于中的ASP.default_aspx.ProcessRequest(HttpContext上下文)c:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \临时ASP.NET文件\ dinglemeyersApplication \ faeebe62 \ 5126d38e \ App_Web_fi2tylhk.5.cs:第0行在System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()在System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值和同步完成)
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)
我已经使用StackOverflow文章中描述的方法解决了这个问题:
I've resolved this problem using the approach described in StackOverflow post:
ASP.NET找不到即使没有使用MySQL,MySQL主机也可以使用
以前,此应用程序在web.config中没有定义任何站点地图.通过进入我的web.config并添加一个站点地图节点,然后添加一个< remove name ="MySqlSiteMapProvider">
,这似乎已经解决了该问题.迁移之后,我将继续测试该应用程序,但现在它可以正常工作!
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!
在我的web.config中:
in my web.config:
<system.web>
...
<siteMap>
<providers>
<remove name="MySqlSiteMapProvider" />
</providers>
</siteMap>
</system.web>