【发布时间】:2021-10-18 14:38:44
【问题描述】:
我正在复制 Web 应用程序部署,并发现了几个与 HTTP Error 500.19 相关的问题。我的机器正在运行 Windows 7,而工作开发正在使用 Windows 8。我们正在使用 Visual Studio 2010 开发我们的 Web 应用程序。
首先,我得到了错误代码0x80070021,类似于发布的here。
我根据接受的答案更新了我的 web.config,然后我得到了以下错误代码(类似于发布的 here)。
HTTP Error 500.19 - Internal Server Error
Error Code 0x8007000d
Config Source -1: 0:
我已阅读Microsoft support page 中的症状定义,错误原因是:
出现此问题的原因是 ApplicationHost.config 文件或 Web.config 文件包含格式错误的 XML 元素。
解决办法是
从 ApplicationHost.config 文件或 Web.config 文件中删除格式错误的 XML 元素。
但是,我使用的 web.config 在原始开发环境中运行良好。
这是我迄今为止检查和尝试过的:
- 通过调用 aspnet_regiis -i 安装 ASP.NET
- 将我的应用程序设置为使用不同的应用程序池(ASP.NET v4.0、.NET v4 等)
- ApplicationHost.config 文件仍使用 Windows 7 的默认设置。
这是我的 Web.Config 的一部分
<system.webServer>
<section name="handlers" overrideModeDefault="Allow" />
<section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
</modules>
<handlers>
<remove name="UrlRoutingHandler" />
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
<urlCompression doStaticCompression="true" doDynamicCompression="false"></urlCompression>
<directoryBrowse enabled="true" />
<defaultDocument>
<files>
<add value="Logon.aspx" />
</files>
</defaultDocument>
</system.webServer>
我在 stackoverflow 中阅读了类似/重复/关闭的帖子(大约 13 个),除了与 Ajax 相关的答案(是否相关)之外,我尝试了所有的帖子,但仍然不知道错误是什么。
有没有人可以解决这个错误? (如果可能的话,需要检查一个完整的列表,这样我们就可以减少类似的帖子。)我准备提供更多细节。
【问题讨论】:
-
我刚刚解决了这个问题。虽然错误指向文件 web.config,但它也可能是 appsettings.config 的问题。如果其中任何一个格式不正确,您都会收到相同的错误。
-
当您的 Web.config 引用了一个缺失的模块(例如:CORS、重写)或者您正在使用带有配置的 IIS Express 时,通常也会出现此错误代码(包括未显示源代码)将使用其中一个模块。
-
双重检查,如果您在机器上安装了托管包。在 .NET Core 下载页面上,有几个下载链接:Hosting Bundle、x64、x86。当您单击 x64 时,您没有下载 Hosting Bundle!
标签: asp.net iis web-applications web-config internal-server-error