preamble
Some time ago we completed the seven-day .NET 8 operation SQLite Beginner to Hands-on development tutorial series, there are a number of students leave a message to ask how to release and deploy the project to run on top of IIS. In this post, we will come together to talk about deploying Core Web API and Blazor Wasm on IIS.
pre-conditions
Install the .NET Core SDK
- /zh-cn/download/dotnet/8.0
IIS Web Server Installation and Configuration
Internet Information Services (IIS) is a flexible, secure, and manageable Web server for hosting Web applications, including Core.
Windows 10 IIS Web server installation and configuration detailed tutorial:/s/oaqypmpHOTLA9_5sF6-W7Q
Installing the .NET Core Managed Bundle
Installing the .NET Core Hosting Bundle is a necessary step when deploying .NET Core applications to IIS. The Hosting Bundle contains several key components that ensure that .NET Core applications run correctly on IIS.
/en-us/download/dotnet/thank-you/runtime-aspnetcore-8.0.7-windows-hosting-bundle-installer
Installing the URL Rewrite Module
The URL Rewrite module must be used to rewrite URLs. This module is not installed by default and does not apply to installing the Serving Functions for Web Server (IIS) Roles feature. You must download the module from the IIS Web site.
If the URL Rewrite module is not installed, the Blazor application will not be able to open the page when deploying IIS:
URL rewrite module download page:
/downloads/microsoft/url-rewrite#additionalDownloads
Reopen IIS and you can see that the installation was successful:
NET 8 operation SQLite Getting Started to practice detailed tutorials
- Day 1 Introduction to SQLite
- Day 2 Configuring the SQLite Environment on Windows
- Day 3 SQLite Quick Start
- Day 4 EasySQLite front-end and back-end project framework construction
- Day 5 introduces SQLite-net ORM and encapsulates common methods.
- Day 6 back-end class management related interface refinement and Swagger customization configuration
- Day 7 BootstrapBlazor UI component library introduction (1)
- Day 7 Blazor class management page writing and interface interfacing (2)
- Day 7 Blazor student management page writing and interface interfacing (3)
EasySQLite project source code address
- GitHub address:/YSGStudyHards/EasySQLite
Core Web API Release Deployment
Released using VS2022WebApi Project
WebApi project deployment IIS
After IIS is deployed, I can't find the localhost page:
Because the environment that runs after the release belongs to the
Production
Environment.
- http://localhost:8899/swagger/
In the path of a successfully published project, find thefile, add the following configuration:
Showcasing Swagger in a production environment is generally not recommended, as it may expose your API documentation and increase security risks.
You can also directly modify the filtering in this Development environment:
<aspNetCore processPath=".\" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
Re-enabled the IIS project and access was successful:
Blazor Wasm Release Deployment
Released using VS2022WebUI Project
WebUI Project Deployment IIS
reference article
- /zh-cn/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-8.0&tabs=visual-studio
- /zh-cn/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-8.0#install-the-url-rewrite-module