Blazor WebAssembly Local IIS from Template

292 views Asked by At

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

There are 1 answers

0
Lewis Houlden On

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]/" />