Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
432 views
in Technique[技术] by (71.8m points)

asp.net core - HTTP Error 500.19 - Internal Server Error (0x8007000d)

I am trying to deploy a .Net Core 5 WASM app to a brand new Windows Server 2019 virtual server and am encountering the very generic The requested page cannot be accessed because the related configuration data for the page is invalid. error message as part of it.

Via Add/Remove programs, I've confirmed I have .Net Core 5.02 Windows Server Hosting, Runtime (x64 and x86) and the 5.0.102 x64 SDK installed. I've read this could be a permissions thing, so I granted Everyone Full Control on all files where the site is at (obviously temporary!) and confirmed within IIS that the .Net Core module is installed.

When I try to edit the configuration file through IIS, I get this prompt, so I know it's mad about something with the web.config, but for the life of me can't figure out what.

enter image description here

The full web.config file (which was generated from publishing via VS [where the app works fine] to a local folder, then copying it up to the web server) looks pretty basic to me. Any ideas? Everything I've searched for on here says either permissions or something about a misconfigured web.config, but nothing obvious stands out. Here's the full 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>
question from:https://stackoverflow.com/questions/66052475/http-error-500-19-internal-server-error-0x8007000d

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After a lot of trial and error, I finally figured it out! The <rewrite /> section is what it was mad about and I had to install the URL Rewrite Module from Microsoft to get it to work. It would've been significantly faster if, instead of just "I can't read this", the error message provided said something like "unknown section <rewrite />, but at least it's working now.

Hopefully this little tidbit helps anyone else standing up a new web server!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...