Goal: Debug an ASP. NET MVC Web site using the local IIS service
Operating system: Windows 8.1 Enterprise Edition
IIS: System comes with IIS6.0
VisualStudio Version: SP5
MVC version: MVC 4.5.1
===================================================================
Profile:
1.IIS Service Installation and configuration
2.Visual Studio Associated IIS Services
3. Intranet access to the site in the debugging
===================================================================
Body:
1.IIS Service Installation and configuration
1.1 IIS Service installation
1.2 User access Rights configuration
Create a Web site directory, we recommend that you do not use IIS default C:\inetpub\wwwroot, creating a D:\IISDebug directory locally, setting folder access permissions, example setting the site directory to everyone Full Control
1.3 Open the IIS console, create a new Web site
1.4 Click the "Select" button, in the "Select Application Pool" page through the "Application pool (L)" drop-down box, select the corresponding program pool version, in this case, the site that needs to be debugged is based on the ASP MVC 4.5 framework, check the system default ". Net CLR version 4.0" to
1.5 Select the physical path of the site, where the path established in 1.2 is selected
1.6 Configure the port, if the port set here is already occupied by another program, the debug program in Visual Studio will get an error, "Debug service failed to start, cannot access virtual directory"
※ At this point we have added a site for VisualStudio debugging, as shown, right-click the site, in the pop-up menu, select "Manage Site", then select "Browse"
At this point, the address of the Web site in the browser should be the "http://localhost:1092/" page as shown below, report an HTTP 403.14 error, ignore it, and continue to configure other IIS settings
2.Visual Studio Associated IIS Services
2.1 Authorization rule configuration, in this example VisualStudio log in to IIS using Anonymous Logon mode, as shown in, add authorization rules that allow Anonymous Logon to IIS
2.2 New Authorization rule add Allow rule
2.3 In the Add allow Authorization Rule screen, select "All anonymous users" and click OK
2.4 Set IIS authentication rules for logged-in users, as shown in, click on "Authentication"
2.5 In the "Authentication" screen, select "Anonymous Authentication" right click, select "Enable" in the popup menu * This example VisualStudio anonymous login, so enable anonymous authentication
Note here that if you turn on other authentication methods, when VisualStudio starts the debug site, a dialog box will be asked to enter the user name and login password to log in to IIS, and if the authentication cannot be logged in via IIS, a 401.2 error will be displayed, as shown in
2.6 Configuring debug options for VisualStudio
2.7 In the Project Setup screen that pops up
① Select "WEB"
② in server, select the Local IIS option
③ "Project URL (J)" To enter the website address that has been built (configured in the 1.6 http://localhost:1092/)
④ Click on the "Create virtual directory" button
2.8 Click OK in the Pop-up dialog, so VisualStudio can log in to the local IIS for code debugging.
3. Intranet access to the site in the debugging
※ When other computers visit our website in local debugging, the address entered is: http://local IP, port number, example of http://localhost:1092/, change to http://192.168.2.110:1092/
3.1 Open the Windows System "Control Panel" ⇒ "System and Security" ⇒ "Windows Firewall" ⇒ "Advanced Settings"
3.2 In the Advanced Settings screen, select Inbound rules, and in the right window select the new rule
3.3 In the New Inbound Rule Wizard screen, select port
3.4 Select "Specific local port", enter the port number of the IIS Web site, in the example 1092
3.5 Select "Allow Connection"
3.6 Stay where you are, click Next
3.7 To find it later, it is recommended to write the name and description
===================================================================
End
VisualStudio Debugging an ASP. NET MVC Web site using the local IIS service