Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i publish a Blazor ASP.NET App in IIS?

i have build a Blazor-Server-App (ASP.NET Core hosted) and published it from Visual Studio to a local folder. It worked fine.

Now i want to publish it on my windows server. It successfully runs some ASP.NET web APIs, so basically its working. It has an own domain.

What i did now is copying the local folder to the server and opening IIS Manager. I added a website and set the path to the folder.

But now, when i click on "Application Setting" i get an error regarding the web.config, see Screenshot.

I would appreciate any hints on why the web.config Visual Studio created does not work with my IIS.

Regards, Tim

enter image description here

like image 652
Timbu42 Avatar asked Apr 09 '20 08:04

Timbu42


People also ask

Does Blazor use IIS?

Blazor WebAssembly apps can be deployed to Azure App Services on Windows, which hosts the app on IIS.

Where can I host Blazor apps?

Blazor apps can be hosted in one of the following ways: Client-side in the browser on WebAssembly. Server-side in an ASP.NET Core app.


1 Answers

to publish blazor app in iis first make sure you installed below iis feature:

enter image description here

  • .NET Core hosting bundle
  • ASP.NET Core Runtime

Download and Install the Runtime and Hosting bundle as per your version.

https://dotnet.microsoft.com/download/dotnet-core/3.1

after installing hosting bundles do not forget to restart the machine. if you installed a hosting bundle bore installing iis you need to repair it.

now Open blazor application in Visual Studio, right-click on a project from solution explorer and select “Publish..” option.

enter image description here

Click on Publish > Start > Folder > choose a folder path and click on the “Create Profile” button.

enter image description here

Click on the “Publish” button.

enter image description here

Now, Open IIS.

Right Click on “SItes” > “Add Website…”.

Set all details like “Site Name”, “Physical path”, “IP address” etc, and click on the “OK” button.

enter image description here

Done!, now right-click on Browse and you can see your hosted application inside the browser.

enter image description here

like image 75
Jalpa Panchal Avatar answered Oct 13 '22 22:10

Jalpa Panchal