Complete steps of deploying asp.net MVC project to local IIS

Time:2019-12-8

Preface

By default, developing a web site in visual studio will run in iisexpress. What if you want to deploy the web site to a local IIS server?

Several key points to configure IIS:

1. URL rewriting module, which used to be the function of ISAPI filter, seems to be revised later, and all of them are modular design.

Asp.net MVC project has routing mechanism, so it does not need to use the default document function and directory browsing function in IIS.

Remember to check the. Net Framework version of the application pool and configure it to v4.0.

4. Generally speaking, authentication is ignored. IIS uses anonymous authentication by default.

Well, I won’t say much next. Let’s have a look at the detailed introduction

The steps are as follows:

First, run visual studio as an administrator, or the following dialog box will pop up when modifying the project properties to prevent us from modifying the server to local IIS.

Then, double-click the properties icon, open the web label, set the server as local IIS, modify the project URL, and make your own name, as shown in the figure:

You can save it successfully.

2. Configure IIS.

Open local IIS. How to install IIS on win8, please refer to. Right click the website and add it, as shown in the figure:

Modify “website name”, “physical path” and “host name”, as shown in the figure above. The website name and host name are the same, and the URL of step 1 is the same. The physical path is the file path of the project. Click OK.

3. Modify the hosts file to point the URL to the local machine.

The hosts file is located in the directory C: \ windows \ system32 \ drivers \ etc. run Notepad as an administrator and open the file. Make the following changes:

Note that it must be run as an administrator, otherwise it cannot be saved after modification. IP 127.0.0.1 is your host. Test.sharpl.com is consistent with the URLs in 1 and 2.

Save, all steps complete.

4. Run the asp.net program and check the URL in the browser, as shown in the figure:

Perfect!

summary

The above is the whole content of this article. I hope that the content of this article has a certain reference learning value for everyone’s study or work. If you have any questions, you can leave a message and exchange. Thank you for your support for developepaar.