How to debug ASP. NET programs published on IIS

Source: Internet
Author: User

E2e testing is required at work, that is, the input is provided, and the output result can be verified. E2e seems simple, but the internal business logic is complicated. It is implemented in an automated manner and requires an understanding of the internal operating mechanism. To simplify the following process, server a receives client requests and sends them to server B. If the result is hit in server B, the request is directly returned to server; if no hit is found in server B, server B Further calls server C. Server C asynchronously searches for Results offline and returns the results to server B. In case, server a constantly sends requests (less than or equal to 15 times) to server B. It is found that there is no hit at runtime, so it is suspected that server C has been called by server B, whether server C has any results returned to server B. To verify this, server B wants to determine whether server C (with an ASP. NET program) is actually called under certain conditions by setting breakpoints ).

The procedure is as follows:

1. Publish ASP. NET Applications to server C;

2. The server C host is in IIS and has its own independent application pool (the pool's name is snippetsimulator)

3. Open the source code of the application in Vs, set the breakpoint, click "debug"-"attach to process", show all processes, find the corresponding process w3wp.exe, and click "Attach.

NOTE: If multiple ASP. to ensure that each application does not interfere with each other, an application pool is usually created for each application. Each Asp.net application corresponds to a worker process, when multiple applications run at the same time, how do I determine which process to attach? We can use the cscript iisapp. vbs command line to determine. (Supplement: In windows2008r2, iisapp. vbs has been removed. All script files are integrated into a command line tool to centrally manage IIS. This is appcmd.exe located under % WINDIR % \ system32 \ intesrv, you can use appcmd list WP to obtain the relevant processes of all application pools. )

The details are as follows:

1. cmd

2. CD c: \ windows \ system32

3. cscript iisapp. vbs

The result is as follows:

W3wp.exe PID: 5400 apppoolid: extractorpool
W3wp.exe PID: 3096 apppoolid: extractorpool
W3wp.exe PID: 2132 apppoolid: snippet
W3wp.exe PID: 3816 apppoolid: keywordserverpool

Based on the application poolid, we can get the ID of the corresponding w3wp.exe process. In this way, you only need to select a unique process based on the ID when appending the process.

When the selected process is correct, the breakpoint is a solid circle. When the selected process is incorrect, the breakpoint is a warning (!) Hollow circle of the sign.

Note: Sometimes, even if the selected process is correct, a hollow circle with a warning will be generated. At this time, we only need to make the following settings: tools-options-debugging-General-uncheck "enable just my code (managed only.

 

There is a link http://www.codeproject.com/KB/aspnet/ProcessAttache.aspx, you can get some extra infomation from here.

 

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.