我們正在將一系列應用程序從舊服務器遷移到新服務器。獲取錯誤:「無法連接到任何指定的MySQL主機。」在不使用MySQL的應用程序中
在我們新的DEV服務器上成功測試此應用程序,然後將代碼提升到新的PROD服務器後,返回一個錯誤。在檢查這個應用程序中的數據庫代碼之後,我確定我們使用的是SQL Server而不是MySQL ......我對爲什麼會發生這個問題感到有點困惑。任何想法或建議?
編輯:我得到了我們的服務器管理員從本地機器查看此錯誤,這是真正被返回,具體與服務器上machine.config上列出的網站地圖提供程序有關...
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
到文件系統日誌進一步挖掘,我找到完整的堆棧跟蹤如下:
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)
在項目搜索 「的MySQL」。有人打電話給MySQL驅動程序...... – 2016-07-26 22:28:58
X,不幸的是,這是我做的第一件事,沒有源代碼的結果。我甚至反編譯的依賴關係,並尋找任何MySQL引用沒有結果... :( –
你檢查了Sitemaps的配置,這似乎是對MySql的引用是在哪裏。也許有一個'web.sitemap '文件,你沒有部署,但掛在你部署到的文件夾,或在IIS根文件夾? –