我最近将一些 Web 应用程序从共享托管环境迁移到我的专用服务器。服务器是 Windows Server 2012 R2 Standard,我的所有站点(同一个 C# Web 应用程序上的所有细微变化)都可以正常工作,但是当您尝试浏览页面时,其中一个站点会抛出此错误。
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
奇怪的是我正在使用System.Web.XMLSiteMapProvider
而不是 MySQL 提供程序(正如错误似乎暗示的那样),请参见下文web.config
<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>
同一应用程序还有两个其他版本(测试版和克隆版)都可以正常工作,并且它们的web.config
文件具有相同的站点地图提供程序。为什么会抛出这个错误,它与什么有关?设置 IIS 时我错过了什么吗?