Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy ASP.NET into IIS

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to deploy ASP.NET to IIS". In daily operation, I believe many people have doubts about how to deploy ASP.NET to IIS. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "how to deploy ASP.NET to IIS". Next, please follow the editor to study!

10.1 deployment to IIS

The ASP.NET Core application supports deployment to IIS, after which it will act as a reverse proxy server and load balancer for the application to relay incoming HTTP requests to the application

By default, the Program class of the ASP.NET Core project creates the WebHost using the following

Public static IHostBuilder CreateHostBuilder (string [] args) = >

Host.CreateDefaultBuilder (args)

.ConfigureWebHostDefaults (webBuilder = >

{

WebBuilder.UseStartup ()

});

The CreateDefaultBuilder method will call the UseIIS method and the UseIISIntergration method, which are used for IIS in-process hosting and IIS out-of-process hosting, respectively

No matter which deployment method is used, the application should be released first.

There are two ways to publish ASP.NET Core applications, using the publish wizard in Visual Studio and using the .NET Core CLI command

First publish to the specified folder through the publish wizard, and then configure IIS. You need to make sure that the current computer has installed IIS and the IIS management console. After completing the configuration, you will visit the website, which will open the Swagger document page, indicating that the website is running normally.

Currently, the application can be accessed through HTTP. For it to support HTTPS in IIS, some configurations are needed, including certificate settings, HTTPS binding, and HTTPS redirection.

IIS does not perform HTTPS redirection when accessing using the HTTP protocol. To support this function, you need to install the URL rewrite tool.

10.2 deployment to Docker

Docker is an open source project that aims to provide a lightweight operating system virtualization solution

Because containers use sandboxing mechanism, multiple container instances do not affect each other, so applications can be deployed to multiple containers and run at the same time

Image and container are two very important concepts in Docker. To put it simply, an image is a template for creating a container, and a Docker container is an application instance created through an image.

Docker supports multiple platforms, including Windows, Linux and macOS systems, and Windows 10 can be used by downloading "Docker for Windows"

To install and use Docker in the Windows operating system, you should first enable the Hyper-V function. Hyper-V can make the Linux container run on the Windows system, which is necessary for the installation and operation of Docker.

For Windwos systems, Docker installs the Linux virtual machine to run and create Linux-based containers in the Windows operating system

Dokcer provides a series of commands for manipulating images and containers

Commands for manipulating Docker images:

Docker build creation

Docker images lists images

Docker pull download image

Docker push publish Image

Docker tag specify label

Docker rmi Delete Mirror

Commands for manipulating the Docker container:

Docker create creates a container

Docker start startup container

Docker run creates and starts

Docker stop stop

Docker rm deletion

Docker ps lists containers that are running

Docker logs View Log

Docker exec executes commands or starts an interactive session in the running container

Parameters supported by the docker create and docker run commands

-- name specifies the container name

The port of the host is mapped to the port of the container.

-- rm when the container stops running, make Docker delete the container automatically

-vmam Metel volume provides data volumes for the specified directory in the container

-emam Musenv provides environment variables for the container

-I runs the container in interactive mode, usually in conjunction with-t

Introduction to Docker Compose

When an application relies on multiple services, such as databases and caches, to deploy it to a container, you can also use Docker commands and Docker network implementation, but it will be cumbersome and error-prone

To this end, Docker provides Docker Compose, also known as Docker container orchestration, which is a tool for describing complex applications that usually need to create multiple containers and use Docker data volumes and Docker networks; in addition, it can orchestrate and manage multiple containers, simplifying the deployment of complex applications to containers without error

At this point, the study on "how to deploy ASP.NET to IIS" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report