containerized existing ASP. NET MVC 5 applications

Source: Internet
Author: User
Tags docker run

The advent of. NET core makes it more common for ASP to be used in a Linux environment. And with the Docker container, the deployment and management of the ASP can be made more convenient. The use of ASP. NET core in new projects is beyond reproach, but for existing projects, such as the traditional ASP. NET Web forms and later ASP. NET MVC, it would be a pity to not use the current container technology. Fortunately, the latest Windows systems (Windows 10 and Windows Server 2016) provide support for Windows containers so that existing applications can be brought together into the management of the container.

To use the Windows container, you first need to turn on this feature.

The second step is to switch Docker to the Windows container

Next, add a new file in the root of an existing ASP. NET MVC project (assuming there is an ASP. NET MVC 5 application), the name is Dockerfile . The contents of the file are as follows:

FROM microsoft/aspnetCOPY ./bin/Release/PublishOutput /inetpub/wwwroot

Then you can click to publish the project.

Run the command to build a new Docker image under the project root docker build -t mvchelloworld . (this will be a long process if you pull the microsoft/aspnet image for the first time)

Start the Docker containerdocker run -d --name mvchelloworld mvchelloworld

View the IP address of the containerdocker inspect -f ‘{{ .NetworkSettings.Networks.nat.IPAddress }}‘ mvchelloworld

Use this address to browse the well-established websites, such as:

If you have already used visual Studio 2017, you can choose to add Docker support on your project without having to manually add the Dockerfile files, Dockerfile and the files and projects will appear docker-compose .

Not only that, you can also debug the Web site in Docker.

After that, all the same, but the old wine has been loaded into the new bottle.

containerized existing ASP. NET MVC 5 applications

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.