Use the command line to enable IIS Express and iisexpress

Source: Internet
Author: User

Use the command line to enable IIS Express and iisexpress

When debugging a WEB program, we can mount the local web program to the local IIS, access the program, and attach the process (w3wp) to debug the program (a debugging method that I like very much), there is also a more traditional way to execute through VS's built-in F5, but it feels very bad, if we have to stop the current program and re-compile and re-run F5 to start c # code, it seems a waste of time. Is there any other way to start the program? The answer is to use the command line to start IIS (IIS Express, which is essentially the same as F5 ).

First, enable the command line tool that comes with vs, which is used for vs 2017 professional. On the command line, enter the following command "C: \ Program Files \ IIS Express \ appcmd.exe "list site and click Enter to display the list of websites registered with IIS Express, as shown in:

We created a new site with VS, but the site address is as follows:

In our site list, there is only the address WebSite1 in the site name. At this time, we can add the site information we just created to the configuration file through the command:

"C: \ Program Files \ IIS Express \ appcmd.exe" add site/name: MyNewSite/bindings: "http: // localhost: 58127"/physicalPath: "C: \ Users \ Administrator \ Documents ents \ Visual Studio 2017 \ WebSites \ WebSite4"

Then, run the following command to start our site "C: \ Program Files \ IIS Express \ iisexpress.exe"/siteid: 2

At this time, you will find that there is an extra startup icon in the lower right corner of the desktop.

At this time, enter http: // localhost: 58127 in the browser. The result is as follows, indicating that the startup is successful through the command line.

And all your requests for page operations are recorded as follows:

Then press Q to stop the current site.

 

If you want to view the site effect on your mobile phone, if you still do not have the permission to access the site on a mobile phone in the same LAN, You need to execute the following command line (note that the command line tool must use the Administrator permission when executing the command line tool)

Netsh http add urlacl url = http: // *: 58127/user = everyone;

Open the applicationhost. xml configuration file in the directory % userprofile % \ documents \ iisexpress \ config.

 

Change

Then re-Execute "C: \ Program Files \ IIS Express \ iisexpress.exe"/siteid: 2, and the phone can be accessed. Perfect.

 

 

 

 

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.