Blazor wasm not serving static files from wwwroot after deploying to IIS

7.5k Views Asked by At

I'm developing a .net 5.0 blazor wasm application. When I run the app form visual studio using IIS Express and navigate to https://localhost:5001/docs/simple.pdf, the file is served in browser.

However the same does not work after deploying the blazor wasm app to IIS. I'm not getting any error instead my Not Found Route template screen gets loaded.

Here is the screen prints:

wwwroot of blazor wasm app:

enter image description here

IISExpress loading the document:

enter image description here

IIS virtual directory path:

enter image description here

IIS not loading the document and display NotFound Route template:

enter image description here

I also noticed none of the files in wwwroot is not directly accessible in browser in IIS. Please assist on what I'm missing.

2

There are 2 best solutions below

7
On

Blazor WebAssembly is not involved in serving your files.

This is something to configure in IIS.

0
On

This seems to be an issue with service-worker.published.js file coming with blazor wasm pwa template. This has been reported in dotnet/aspnetcore repo.

Please follow the issue in github for more updates.