Run ASP. NET Core Web API application in docker (with AWS Windows Server 2016 widt Container case), dockeraws

Source: Internet
Author: User
Tags dotnet docker run microsoft website

Run ASP. NET Core Web API application in docker (with AWS Windows Server 2016 widt Container case), dockeraws
Environment preparation

1. Amazon EC2 Windows Server 2016 with Container

2. Visual Studio 2015 Enterprise (Update required for Profresianal)

3.. NET Core 1.0.0-VS 2015 Tooling Preview 2. Click here to install

4. Microsoft. NET Core SDK, which can be downloaded and installed on the official Microsoft website

5. Visual Stuido Tool For Docker (download and install it in VS extension)

 

 

Lab procedure

I. Prepare the Docker Environment

Amazon EC2 Windows Server 2016 with Container has built-in Docker, as shown below:

Click search in the lower left corner of Windows and enter "Server Manager ",

Add Role or Featurn to the right of the Dashboard

Unlike servers, roles and features are added together. Click Next here and find that Hyper-V in Roles is not enabled. Many people say they want to enable it. I didn't enable it here.

There is a Container in features. This is Docker.

Verify that Docker is installed. Run the following command under CMD to verify the installation:

If docker info can be identified and executed, it indicates that Docker has been installed successfully.

2. Develop ASP. NET Core WebApi

Before starting VS2015, make sure that DotNetCore.1.0.1-VS2015Tools. Preview2.0.2 and Visual Stuido Tool For Docker are installed (download and install in VS extension)

Comment out the Dockerfile generated by the tool. Otherwise, an error will be reported when running the docker run Command (dotnet dockerwebapidemo. dll needs to be run in powershell)

Save automatic compilation and run dotnet publish in the root directory of the program. The publish folder is automatically compiled and generated in bin.

 

Run docker build in the publish folder to generate a docker image.

Note that the last vertex indicates the current path.

View the generated image

Run containers

Docker run-it-p 8600: 5000 xucixiao/dockerwebapidemo

The following interface is returned to indicate that the container is successfully started.

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.