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.
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>
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!
User contributions licensed under CC BY-SA 3.0