Cannot host Blazor WebAssembly App via IIS
See original GitHub issueDescribe the bug
Cannot host into my IIS Blazor WebAssembly App project.
I created a new Blazor project using Visual Studio 2019 (look at the picture)
I checked https, ASP.NET Core hosted and Progressive Web Application
After that visual studio creates the client project,the server project and a shared class project. I make sure that the project has no error so I compile it and run it on visual studio.
After that I want to host it into my IIS , so i go into the server project , right click , publish and I publish everything into my release folder.
Everything goes fine, now I go into my IIS , add new site, and select the path of the publish folder generated before (I used the port 80 for this test).
I also grant to the web config the IIS_IUSRS permission.
Now I type localhost:80 into my browser and I go into an infinite loop of waiting for the page that loads , but it never loads.
No errors are shown into the browser.
So I went into my IIS manager and say that the web config generated by default by visual studio is seen as wrong.
My webconfig.xml :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Funzia.Server.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 4872489F-5CAD-4DF4-BAFC-9D401F53BF48-->
I have installed ASP.NET core Runtime bundle also dotnet-hosting-2.2.2.
In fact I can easily host a Server App blazor , zero problems, but when I try to publish an Blazor WebAssembly App it is not working.
Other useful info:
The modules are not missing.
I also tried to add an autosigned certificate and tried to access by https but I’ve experienced the same result as going with http.
More further I also tried to publish the project via console , I thought that maybe visual studio could create corrupted web config file, but the file created was the same.
I’ve found that also some other users are experiencing this problem but I have not found any solution yet.
I even tried to follow this video : https://www.youtube.com/watch?v=k2qAuwNpM_s , but for me the same things that he does are not working, as my browser will keep loading for an infinite amount of time my webapp.
Any suggestions?
To Reproduce
Exceptions (if any)
Further technical details
- ASP.NET Core version 3.1
- Include the output of
dotnet --info
: .NET Core SDK (che rispecchia un qualsiasi file global.json): Version: 3.1.301 Commit: 7feb845744
Ambiente di runtime: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.301\
Host (useful for support): Version: 3.1.5 Commit: 65cd789777
.NET Core SDKs installed: 3.1.300 [C:\Program Files\dotnet\sdk] 3.1.301 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
- The IDE (VS / VS Code/ VS4Mac) you’re running on, and it’s version: Visual studio 2019, version 16.6.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
That comment was based on supplying the required web.config manually.
The standard web config that should be generated when publishing a standalone wasm application to IIS is as follows:
You can put this in your wwwroot folder and it will be published to IIS. However, the publish process will still add the incorrect aspnet handler lines. If you manually delete those after publish it should work. However, this would need to be done every time you publish, so it is not really a solution
Duplicate of #24568