Use the Visual Studio. NET Debugger for ASP. NET Applications

Source: Internet
Author: User
Tags dedicated ip keep alive

Abstract:Debugging ASP. NET may be tricky because account configuration and interaction can cause interruptions in multiple different steps. This article briefly discusses and debugs ASP. NET ApplicationsProgramRelated Frequently Asked Questions: List Error Examples and explain how to solve these problems.

Content on this page
Introduction
ASP. NET debugging.
Regular debugging
Causal debugging: steps between the Web service client and the Web Service
Remote debugging

Introduction

In the past few months, I have worked with many users who have debugging problems, some of which are from within Microsoft. I found that if users can get the correct diagnosis, many common errors and problems will be solved. Therefore, I wrote this articleArticleTo provide users with information that can help them solve problems when using the debugger.

This document includes:

Error message dialog box or error description

The cause of the above error.

The solution to the above problems.

Here, I would like to express my gratitude to the VCs debugger team and those who helped me complete this article and provide me with wonderful feedback.

ASP. NET debugging.

NoteIf you cannot find the expected error message in this section, check the common debugging problem section or remote debugging problem section.

Message: cannotWebStart debugging on the server.

Figure1.Failed to start debugging error message

Cause1:The IIS application is not configured to useIntegrated Windows Authentication. Make sure that the authentication method dialog box is selectedIntegrated Windows AuthenticationCheck box, as shown in 2.

Figure2.Enable integrated Authentication

Cause2:Check the IISEnable HTTP keep alive. If it is disabled, you may need to open it and try debugging again.

Message: You are not authorized to debug the server.

Figure3.No debugging permission

Cause1:Make sure it is enabledIntegrated Windows Authentication. The possible cause is that IIS Directory Security is only enabled.Basic Authentication.

Cause2:If you are usingIntegrated Windows AuthenticationMake sure that your user account has full control over the IIS directory.

Cause3:If you use the complete machine name (suchMachinename. domainname. Something) To create a web project, the web site will be recognized as an Internet site. Therefore, the default settings of Internet Explorer will affect logon behavior. In this case, you need to use the current account to enable logon in the "Internet" area with IE settings.

However, this is not the default setting for Internet Explorer, so it is best to use only the machine name to create a project and use figure 4 as the Security Settings guide.

Figure4.SetInternet ExplorerAuthentication

Message: sending and debuggingHTTPA server error occurred during the request.

Figure5.Server errors during debugging

Cause1:The Web application does not have an application name. Therefore, use iis mmc to check the properties of the web project and ensure that the web project has an application name. The Application name should appear when the red profile in Figure 6 appears.

Figure6.Set Application name

Cause2:If the NTFS file format is used, make sure that "ASPnet" has "wwwroot" or the appropriate permissions on the virtual directory folder to access and write these folders.

Message: The project is not configured for debugging.

Figure7.No configuration item for debugging

If this error message is displayed, configure the web for debugging. Therefore, you need to set DEBUG = true in the web. config file. This file is located in the web project folder.

You can start debugging without any error message, but cannot reach the breakpoint.

You useF5It seems that the debugging is started correctly and Internet Explorer is started correctly, but you cannotCodeThe breakpoint in the hidden code.

Cause1:Not Enabled in Project PropertiesAsp.netDebugging. Set this item to true as shown in figure 8.

Figure8.EnableASP. NETDebugging

In VB projects, the UI is different, but equivalent items can be easily identified.

Cause2:Make sure that the desired DLL is loaded using the matching debugging symbol file. AvailableModulesWindow to check this.

Message: the debugger is not correctly installed.

Figure9.The debugger is not correctly installed.

If you see this problem, check the debugging function in the console application project. If the console application project displays the error message 10, it indicates that the. NET Framework application is not correctly installed.

Figure10.Debugging cannot be started.

You must manually register "mscordbi. dll" by executing "regsvr32 mscordbi. dll ".

Message: the server does not supportASP. NETOrATLDebugging of server applications.

Figure11.Debugging cannot be started.

If you have installed Windows XP Pro or Windows 2000 pro on your machine, you may need to consider the installation sequence between Visual Studio 7 and IIS. This error occurs if IIS is installed after Visual Studio 7. In this situation, use registraspnet_regiis.exe-I to register "aspnet_isapi.dll ".

Message: Access denied. Check whether you are an administrator or a group member.

Figure12.Access denied

You may not be on this computerDebugger usersGroup member. Add your user account toDebugger usersGroup to solve this error.

To add your user accountDebugger usersGroup, you must perform the following operations:

1.

AsAdministratorLog on.

2.

RunAdministrator toolsInComputer Management.

3.

SelectLocal users and groups \ groupsNode.

4.

Double-clickDebugger usersGroup.

5.

ClickDebugger users PropertiesIn the dialog boxAddButton.

6.

Type a user account and clickOK.

Message: cannot startASP. NETOrATLServer debugging.

Figure13.Not InstalledASP. NETOrATL

Cause1:You may have installedIIS LockdownTool. If so, search for the URLScan. ini file and add debug (case sensitive) to the [allowverbs] section.

Cause2:If you use the domain controller as a server and the project is created using a machine name (incomplete domain name), you may need to change the project URL to a complete domain name.

Cause3:If you set IIS to use a dedicated IP address (for exampleWeb site identification, You can find this option in iis mmc settings), you may see this error message. In this case, you need to change the project name and use the IP address directly. For an existing project, you need to change the project to use the IP address, instead of using the machine name by editing the. sln file and. webinfo file.

Cause4:The value in the web. config file is too large. The default unit is kilobytes rather than bytes. Therefore, if an incorrect unit is used to change this number, debugging may occur.

Message: Access denied.

Figure14.Access denied

Cause:You may beDebugger usersBut you do not have the permission to debug the ASPNET auxiliary process, because you are notASPnetUser Account orAdministratorsGroup member. Add your user account toAdministratorsGroup to solve this problem.

The included files cannot be used for debugging.

In aspx, the included files cannot be used for debugging. When the old ASP project is converted to aspx, files are usually generated.

If a file is included, you may not be able to debug the file correctly. You must use it instead.

After changing the password, you need to log out/LoginASP. NETDebugging.

After changing the password, you must log out and then log on to ASP. NET for debugging.

InstallWindows2000 SP4After,ASP. NETDebugging fails and messages are displayed at the same time."Access denied".

The solution to this problem is to useRegsvr32-I aspnet_isap.dllRegister againAspnet_isap.dll.

You only encounter a breakpoint when loading the page for the first time.

For this specific problem, there may be multiple reasons, but the most likely is that youWeb. configThe page cache option is set in the file.

IfWeb. configTo disable Web page caching, set the value to "false. After you change the settings and refresh the page, you may encounter a breakpoint.

You need to shareWebServer for debugging, but do not want other users to become computer administrators.

In Visual Studio. NET, you can determine whether the user can perform debugging. One of them isDebugger usersThe other is user permissions, such as administrator, power user, or sedebug.

The debugger Users Group determines whether users can access vs debugging components (mainly mdm-machine debug manager, part of Visual Studio). Therefore, membership in this group means that users can access MDM. Therefore, you can debug open processes and view the process list on the machine.

However, whether or not you can debug the processes of other users depends on your permissions. For example, if you want to debug a local process of another user, you must have the sedebug permission. For a hosted process of another user, you must be the administrator of the machine to perform debugging.

Because of this restriction, you should grant the student administrator permission in your plan. Otherwise, the ASP. NET auxiliary process cannot be debugged by default.

We have a work und. Cassini is an independent small ASP. NET Server. For students, they can use Cassini for development and deploy the development results to the actual server later to submit the results. Cassini is located in

Regular debugging

These cases are based onConsole ApplicationProject type.

Message: Debugging cannot be started.

Figure15.Unable to start the program

The problem shown in Figure 15 is caused by incorrect registrationMscordbi. dll. The remedy is to manually register the file.

Message: Debugging cannot be started. Access is denied.

Figure16.Access denied error message

Ensure proper startupMachine debugger ManagerAnd make sure that you areDebugger usersOrAdministrators.

I can start hosting debugging,PDBDoes not load, and cannot encounter any breakpoint.

If the debugger is correctly started, but no breakpoint is encountered, you may need to checkDiasymreader. dll. This file may not be registered. To register the file, perform the following operations:

 
Regsvr32 \ diasymreader. dll

Hosted debugging does not run

Before a process creates a CLR object, it connects to a local process in clr mode. Hosted debugging does not run.

Solution1:Use the CLR code in the process and then connect to the process.

Solution2:Connect processes in InterOP mode. In this case, you do not have to connect to the process after calling the CLR code.

The hosted debugger does not respond.

When debugging is started using managed code, the debugger does not respond.

Solution:Make sure it is stopped and Disabled. Net frameworksupportService (it is not enough to stop the service only ).

If not. Net frameworksupportService, disableIIS AdminService.

UseC #Incorrect code single-step debugging

Consider the following code:

 
String somestr; somestr = "somevalue"; if (somestr = NULL) console. writeline ("what's up? "); Try {} catch (exception e ){}

If you use this code, the command pointer will be moved to the "if" Statement body (console. writeline ("what's up? ");).

This is not a debugger bug, but a well-known try catch block debugging information problem. See the disassembly code of the try catch block example in the following debugger.

 
If (somestr = NULL) a cmp dword ptr [ebp-18h], 0e JNE cconsole. writeline ("what's up? "); MoV ECx, dword ptr ds: [01c50070h] Call dword ptr ds: [02f0257ch] C jmpcatch (exception e) e mov dword ptr [ebp-1Ch], eaxcall c0846jmp} NOP

If the value does not match, the command pointer is moved to the 003c JMP line, but the row is incorrectly matched with the if statement body. When the code function is correct, the display is incorrect.

Back to Top

Causal debugging: steps between the Web service client and the Web Service

Not availableWebService clientWebService configuration debugging

By default, the Web service client is not allowed to access the Web service. Its running mode is similar to step-over.

The ASPnet auxiliary process (aspnet_wp.exe or w3wp.exe) runs under the "ASPnet" or "Network Service" User Account, which has no permissions to access MDM through DCOM. Therefore, you need to add these accountsDebugger usersGroup.

EnableWebAfter service simulation, you cannot use the causal step.

When "Web. config" is used to enable simulation for a Web service, the Web Service Code cannot be entered from the Web service client code. Because it runs in a similar way to step over.

You must perform the following operations to correct the steps between the client and the service.

DisableAnonymous Access.

Change the client code and set the creden to Web services as follows:

Service1 OBJ = new service1 ();

OBJ. Credentials = system. net. credentialcache. defaultcredentials;

After that, you can access the Web service from the client.

These operations are required because some. NET Framework components need to be jointly created using the system-level Debugger component (MDM) when you enter the web service. If you cannot provide the correct creden。, this step fails. Without these correct creden, "Step into" runs like "step over ".

Debugger Suspension

If the Web service client code runs in the sta (single thread apartment) model and is waiting for the asynchronous call to complete, as shown below:

Service1 OBJ = new service1 (); system. iasyncresult AR = obj. beginhelloworld (new system. asynccallback (class1.handle), OBJ); While (AR. iscompleted! = True) {system. Threading. thread. Sleep (1000 );}

The debugger is suspended. This suspension occurs because the code in the debugger has locked a Debugger component. Solution 1 is to change the code to use the thread that is synchronized with the event or mutex. Another solution is to log out of CSM. dll. Solution 2: Disable causality (steps from web service client code to Web service method ). You may need to manually connect to aspnet_wp.exe to debug the web service.

Remote debugging

Unable to view any processes on the remote machine

Make sure that you have installedRemote full debugAnd you areDebugger usersGroup member.

BecauseRPCUnable to connect to the remote machine due to a problem

The following information is taken from the KB article written by Mike clay.

If the following error message is displayed when you connect to a remote machine through the "processes" dialog box:

 
Error while trying to run project: unable to start debugging on theweb server. Not enough storage is available to complete this operation.

You can also see this message during ASP. NET debugging:

Error while trying to run project: unable to start debugging on the webserver. Unable to map the debug start page url to a machine name.

Make sure that RPC runs correctly between your machine and the remote machine. The following behavior may cause RPC problems:

Debug through the firewall. Microsoft does not recommend or support remote ASP. NET debugging through the firewall. The best way to solve this problem is to use "Terminal Service" to log on to the remote server and debug it locally.

A common failure of RPC is the inability to resolve remote machine names. RPC relies on name resolution for communication between computers. If you fail to resolve the remote server machine name to the correct IP address, an error may occur.

RPC communication can only flow in one direction, but not in the other direction. RPC communication must be able to reach the remote server from the machine used for debugging and return the machine used for debugging from the remote server. In this way, remote debugging can be successful. Make sure that RPC communication is enabled in two-way.

To analyze RPC, you can useRpcpingTool.

Failed to remotely debug the machine in the workgroup

This happens when both of your Windows xp pro machines are not in the domain but are in the workgroup. During remote debugging between them, you cannot access the remote machine at all.

In the workgroup environment, make sure that the two machines have the same user account name and password. Otherwise, DCOM will fail authentication.

In addition, on Windows XP ProSharing and security model for local accountsTo allow sharing. Follow these steps to change the settings:

1.

In the running administrator toolLocal Security Settings.

2.

SelectSecurity Settings \ Local Policies \ Security.

3.

SetNetwork Access: Sharing and security model for local accountsSlaveGuest only-Local Users authenticate as guestChangeClassic-Local Users authenticate as themselves.

4.

Restart the computer.

This change should be applied to two machines for remote debugging.

After changing the settings, you can use the user account with the same name to perform remote debugging on the two machines. Make sure that the user account on each machine has a password. In some cases, machines without actual passwords cannot run.

However, because the default settings of the security model have been changed, the following content may be disclosed:

Accidental file sharing

Unexpected DCOM component sharing.

Before this change, any type of connection from the remote machine to your machine isGuestIdentity, but after the change, he/she can be authenticated using a local user account. Therefore, in the debugging case, if a folder or DCOM object is shared, any matching user (with the same user name and password) on other machines) you can access your shared objects.

I strongly recommend that you use this work und to ensure that all user accounts have strong passwords; otherwise, you should set up a network Island to debug machines to prevent malicious attacks.

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.