1
votes

I am completely baffled why I cannot run the template produced by Visual Studio for Blazor WebAssembly. I've created the project from scratch with the default template (with the counter etc.). IIS Express works absolutely fine, but as soon a I change it to Local IIS, it cannot find any of the resources:

enter image description here

Why is it looking for resources at root of localhost, shouldn't it be for example http://localhost/BlazorApp1/_framework/blazor.webassembly.js

I have no doubt I am missing something obvious, but I cannot find any other SO post about it. Any help is much appreciated.

1
Is the .NET core Hosting bundle installed? How are you "switching to local iis", or what deployment method are you using? - thewallrus
Yes .net core hosting bundle is installed. I'm creating a new debug profile and setting that to use Local IIS. There is another gotcha with changing to local IIS too. You lose the ability to debug code because the inspectUri is not included as which tells Visual Studio where to attach the debugged. I had to copy from the IIS Express config and adjust the URL to include the name of the site. - Lewis Houlden

1 Answers

2
votes

I have found that you need to add the name of your site to the base href in index.html. I'm not sure if there's a way to programatically do this but manually changing it works

From:

<base href="/" />

To:

<base href="/[SiteName]/" />