In the actual development, I believe that many developers debug asp.net website directly through the compilation and operation of visual studio tools.
In general, there are not many problems with this debugging method, but sometimes we will find that when a website is deployed to the server IIS, there will be an indescribable online problem. At this time, it is necessary to exclude whether the server environment is the same as the local environment, one of which involves the exclusion of IIS configuration.
That’s the problem. Can we deploy debugging on IIS instead of using visual studio to run debugging directly when developing, so that problems related to IIS configuration can be exposed as early as possible, such as IIS user’s permission call, etc. For example, when we call Microsoft’s Office Excel component to export excel, we need to set the IIS user group’s call permission to COM component.
In the development stage, debugging the website through IIS can avoid many problems caused by IIS settings.
Next, we will configure IIS debugging.
The first step is to open your IIS manager. If you don’t have an IIS server installed, please go online to Baidu to install it. I won’t elaborate here. Create a new website in IIS, give a host domain name of test.com, and point the website directory to the root directory of your web project, as shown below.
Step 2: the application pool configured for the website is critical. The name of the application pool in the figure above is testweb. Then the version number of. Netframework of the application pool should be the same as the version used in your project. Click application pool on the left side of the above figure to open the application pool list, select the application pool with testweb name, and confirm to edit the version number of the application pool. Following chart
The third step is to make sure that your IIS status is running instead of stopping, and that your web site’s status and the corresponding application pool’s status are running.
Step 4: set the host file of the local computer and configure the local domain name test.com. Let the browser recognize that the domain name of test.com points to the local computer. (this step is very critical, otherwise you can enter test.com in the browser and tell you that it cannot be parsed.)
We look for the host file of the system in the C disk of the computer. The host file is usually located in the following path: C: \ windows \ system32 \ drivers \ etc.
After finding the host file, open the host file with a text editor. Notepad + + text editor is recommended. After opening, we can add 127.0.0.1 test.com in the last line, and save after configuration (win10 system may not be able to edit and save, we usually copy the file, and overwrite the original file after editing). Enter test.com in the browser to point to the website in local IIS, that is, the website you just configured.
Step 5 after the configuration, when we input test.com into the browser of our local computer, it will point to the test.com website configured by your local IIS, that is, the website you are currently developing.
Step 6 if the corresponding problems are found in the test.com website test, we can debug the website by attaching IIS process. Of course, the debugging method is different from the previous one. At this time, you can’t directly click the debugging button in visual studio or F5 to debug. We can enter the debugging mode in the following way, select the debugging on the menu bar, open the submenu and select attach to process, as shown in the following figure (of course, you can directly access the additional interface through the shortcut key Ctrl + Alt + P)
After opening the additional interface, as shown in the figure below, we can find the w3wp.exe process, and then click the additional button.
After the attachment is completed, you can add the corresponding breakpoint debugging in the code. If you enter test.com in the foreground browser to access the error, you can find the corresponding code segment in visual studio to add the breakpoint.
Through the above steps, the website can be debugged well, and the corresponding configuration problems of IIS can be found as early as possible.
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.