1

I've been able to deploy a blazor webassembly application to a new website in iis without a problem (so I think I have the correct pre-reqs installed). i.e. In IIS Manager, I use the 'Add Website' feature where I can configure a site name, physical path and port. I can browse to the website and it functions as expected.

What I want is to be able deploy the application to the default website by using the Add Application feature in IIS. When I do that I have problems browsing to the site.

The error message in the browser is "An unhandled error has occurred. Reload". When I view the errors in the developer tools there is a bunch of 404 errors saying "Failed to load resource: the server responded with a status of 404". I'm using IIS v10

brendan
  • 141
  • 5

1 Answers1

1

Followed the instructions here https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-5.0#host-as-an-iis-sub-app-1 which meant two changes

  1. Added a handler to the web.config. Note see this post if this results in an error about the section being locked

    <handlers>
      <remove name="aspNetCore" />
    </handlers>
    
  2. Edit of the wwwroot/index.html in which I changed

    <base href="/" />
    to
    <base href="/{nameOfApplication}/" />
    
brendan
  • 141
  • 5