HTTP 错误 500.19 - 内部服务器错误 (0x8007000d)
HTTP Error 500.19 - Internal Server Error (0x8007000d)
我正在尝试将 .Net Core 5 WASM 应用程序部署到全新的 Windows Server 2019 虚拟服务器,但遇到了非常通用的 The requested page cannot be accessed because the related configuration data for the page is invalid.
错误消息。
通过 Add/Remove 程序,我确认我安装了 .Net Core 5.02 Windows 服务器托管、运行时(x64 和 x86)和 5.0.102 x64 SDK。我读过这可能是一个权限问题,所以我授予每个人对网站所在的所有文件的完全控制权(显然是临时的!),并在 IIS 中确认安装了 .Net Core 模块。
当我尝试通过 IIS 编辑配置文件时,我得到了这个提示,所以我知道它对 web.config 的某些东西很生气,但我终究无法弄清楚是什么。
完整的 web.config 文件(通过 VS [应用程序运行良好的地方] 发布到本地文件夹,然后将其复制到 Web 服务器生成)对我来说非常基础。有任何想法吗?我在这里搜索的所有内容都说权限或配置错误 web.config,但没有什么明显的。这是完整的配置:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<customErrors mode="Off" />
</system.web>
<system.webServer>
<staticContent>
<remove fileExtension=".blat" />
<remove fileExtension=".dat" />
<remove fileExtension=".dll" />
<remove fileExtension=".json" />
<remove fileExtension=".wasm" />
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".blat" mimeType="application/octet-stream" />
<mimeMap fileExtension=".dll" mimeType="application/octet-stream" />
<mimeMap fileExtension=".dat" mimeType="application/octet-stream" />
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension=".wasm" mimeType="application/wasm" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff" />
</staticContent>
<httpCompression>
<dynamicTypes>
<add mimeType="application/octet-stream" enabled="true" />
<add mimeType="application/wasm" enabled="true" />
</dynamicTypes>
</httpCompression>
<rewrite>
<rules>
<rule name="Serve subdir">
<match url=".*" />
<action type="Rewrite" url="wwwroot\{R:0}" />
</rule>
<rule name="SPA fallback routing" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="wwwroot\" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
经过反复试验,我终于想通了! <rewrite />
部分令人抓狂,我必须安装 Microsoft 的 URL Rewrite Module 才能使其正常工作。如果所提供的错误消息不是“我无法阅读”,而是类似“未知部分 <rewrite />
,但至少它现在可以工作。
,那么速度会快得多。
希望这个小花絮能帮助其他人建立新的网络服务器!
我正在尝试将 .Net Core 5 WASM 应用程序部署到全新的 Windows Server 2019 虚拟服务器,但遇到了非常通用的 The requested page cannot be accessed because the related configuration data for the page is invalid.
错误消息。
通过 Add/Remove 程序,我确认我安装了 .Net Core 5.02 Windows 服务器托管、运行时(x64 和 x86)和 5.0.102 x64 SDK。我读过这可能是一个权限问题,所以我授予每个人对网站所在的所有文件的完全控制权(显然是临时的!),并在 IIS 中确认安装了 .Net Core 模块。
当我尝试通过 IIS 编辑配置文件时,我得到了这个提示,所以我知道它对 web.config 的某些东西很生气,但我终究无法弄清楚是什么。
完整的 web.config 文件(通过 VS [应用程序运行良好的地方] 发布到本地文件夹,然后将其复制到 Web 服务器生成)对我来说非常基础。有任何想法吗?我在这里搜索的所有内容都说权限或配置错误 web.config,但没有什么明显的。这是完整的配置:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<customErrors mode="Off" />
</system.web>
<system.webServer>
<staticContent>
<remove fileExtension=".blat" />
<remove fileExtension=".dat" />
<remove fileExtension=".dll" />
<remove fileExtension=".json" />
<remove fileExtension=".wasm" />
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".blat" mimeType="application/octet-stream" />
<mimeMap fileExtension=".dll" mimeType="application/octet-stream" />
<mimeMap fileExtension=".dat" mimeType="application/octet-stream" />
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension=".wasm" mimeType="application/wasm" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff" />
</staticContent>
<httpCompression>
<dynamicTypes>
<add mimeType="application/octet-stream" enabled="true" />
<add mimeType="application/wasm" enabled="true" />
</dynamicTypes>
</httpCompression>
<rewrite>
<rules>
<rule name="Serve subdir">
<match url=".*" />
<action type="Rewrite" url="wwwroot\{R:0}" />
</rule>
<rule name="SPA fallback routing" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="wwwroot\" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
经过反复试验,我终于想通了! <rewrite />
部分令人抓狂,我必须安装 Microsoft 的 URL Rewrite Module 才能使其正常工作。如果所提供的错误消息不是“我无法阅读”,而是类似“未知部分 <rewrite />
,但至少它现在可以工作。
希望这个小花絮能帮助其他人建立新的网络服务器!