C# 奇怪';MySqlSiteMapProvider';错误,尽管';XmlSiteMapProvider';正在使用
我最近将一些web应用程序从共享托管环境迁移到了我的专用服务器。服务器是Windows server 2012 R2标准,所有“我的网站”(同一个C#web应用程序上的所有细微变化)都可以正常工作,但是当您尝试浏览页面时,其中一个网站会抛出此错误C# 奇怪';MySqlSiteMapProvider';错误,尽管';XmlSiteMapProvider';正在使用,c#,web-config,iis-8,sitemapprovider,C#,Web Config,Iis 8,Sitemapprovider,我最近将一些web应用程序从共享托管环境迁移到了我的专用服务器。服务器是Windows server 2012 R2标准,所有“我的网站”(同一个C#web应用程序上的所有细微变化)都可以正常工作,但是当您尝试浏览页面时,其中一个网站会抛出此错误 Server Error in 'ABC' Application. Configuration Error Description: An error occurred during the processing of a configurati
Server Error in 'ABC' 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: Host 'SERVERNAME' is not allowed to connect to this MariaDB server
Source Error:
Line 283: <siteMap>
Line 284: <providers>
Line 285: <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
Line 286: </providers>
Line 287: </siteMap>
Source File: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config Line: 285
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2053.0
同一个应用程序还有两个其他版本(BETA和克隆版),它们都工作正常,并且它们的
web.config
文件具有相同的站点地图提供程序。为什么会抛出此错误,它与什么有关?我在设置IIS时错过了什么吗 请注意,错误来自machine.config
,而不是web.config
。所有web.config
文件基本上都继承自基本机器版本。要覆盖提供程序,只需先清除列表即可。例如:
请注意,错误来自machine.config
,而不是您的web.config
。尝试将
添加到web.config
提供程序列表中,以确保您仅使用指定的提供程序。感谢@DavidG的建议-我应该在我的XmlSiteMap提供程序条目之前还是之后添加此项?按照顺序在您的条目之前添加。谢谢,我这样做了,它引发了另一个错误(未指定defaultProvider)-您是否可以更新您的答案,以便为可能发现相同问题的用户提供defaultProvider?好的,我已经为您添加了这个选项。
<siteMap>
<providers>
<add name="Admin" type="System.Web.XmlSiteMapProvider" siteMapFile="~/MenuSystem/Admin.sitemap" />
<add name="Branch" type="System.Web.XmlSiteMapProvider" siteMapFile="~/MenuSystem/Branch.sitemap" />
<add name="Supplier" type="System.Web.XmlSiteMapProvider" siteMapFile="~/MenuSystem/web.sitemap" />
</providers>
</siteMap>