In this tutorial, we will show how to publish ASP.NET Core Blazor to IIS. This is only simple template in Visual Studio 2019. Here we go
Requirement
- Make sure you install Visual Studio 2019 Community Edition
- Install .NET Core 3.1 or above.
Steps to Publish ASP.NET Core Blazor in IIS
1. Make sure that your IIS Web Server up and Running
You can check it on your Program and Features on your localhost. Make sure that you have enabled Web Management Tools and World Wide Web Services as you can see below
Once you have enabled the feature above, you might require to restart your computer. See figure below:
2. Install ASP.NET Core Runtime Hosting Bundle
The second step is to install the ASP.NET Core Runtime Hosting Bundle. The Blazor Server is executed as an ASP.NET Core application on the server, so the runtime requirement is the same as an ASP.NET Core application.
Make sure you install hosting bundle above. Completing this step will make the IIS ready to host the Blazor Server application.
3. Ready to Create Blazor Server Application
Right-click on the Server project of your solution and click publish. In this case, it will be BlazorDDL.Server >> Publish.
You will see a screen similar to below. Select the folder from the left menu and provide a folder path. You can provide any folder path where you want to publish your app.
Click on publish. Visual Studio will start publishing your application. If there are no build errors, then your application will be published successfully in the folder you have mentioned.
4. Host Blazor in IIS
As shown above, we have successfully publish Blazor, now we are going to host it on IIS.
1. Copy your publsihed folder to webroot folder C:\inetpub\wwwroot\
2. Open IIS Manager
Click Windows -> Run -> type inetmgr and then click OK
3. Add Your Website in IIS
4. Browse your Application
5. DONE!
Conclusion
Yes, that’s only simple steps to publish your ASP.NET Core Blazor Application in IIS. If you find this tutorial helpful, you can always share it. Thank you!
Andriy Kravets is writer and experience .NET developer and like .NET for regular development. He likes to build cross-platform libraries/software with .NET.