Search code examples
c#iisdeploymentblazorblazor-webassembly

Blazor WebAssembly deployment failed to IIS localhost


I am trying to deploy my blazor WebAssembly project to IIS localhost. However, it does not load in the browser with the following errors:

enter image description here

So far I have tried to resolve this issue by setting "PublishTrimmed" to false. This did not resolve my issue. I have seen other people online have a similar problem and recommended the fix just mentioned (which did not resolve the issue for me). Thanks.


Solution

  • The fix for me was to delete the bin and obj folders in, both, the server and client projects with "PublishTrimmed" set to false in the csproj of the server project. Then use dotnet publish -o "location" -c release in powershell (in the server project directory) to publish to the target location set in IIS. Now everything works as expected.