ASP.NET Secrets, Part 4, Page 3
Ten Steps to Successful Debugging
It's terrible when it happens—but rest assured, it will happen. You see, debugging Windows programs is a pretty simple process and one not prone to failure. But debugging Web applications is much more fallible.
So, what should you do if you attempt to start debugging a Web application and get the dreaded "Unable to start debugging on the Web Server" error? Here's your one-stop checklist...
- Are you working offline in Internet Explorer? Launch Internet Explorer and look in the File menu. If "Work Offline" is checked, click it to unselect this option, restart Visual Studio .NET, then try again.
- Are there syntax errors in Web.config? If there are, you won't be able to start debugging. To check this, click Debug, Start Without Debugging and see whether your browser reports back an error. If it does, fix it and try again.
- Are you running Windows 2000 or Windows XP? If so, continue to step four. If you're debugging a remote ASP.NET application under Windows NT 4, you'll need to launch the application without debugging, then manually attach to it. Look up "debugging ASP.NET Web applications, system requirements" in the Help Index for more information. Word of advice: upgrade.
- Are you a member of the Debuggers Users group? You may be logged on as Administrator, but it's still worth checking. If you're not in the group, you may be denied your debugging rights.
- Does your Web.config file have its "debug" attribute set to "true"? If not, you're going nowhere. You might also want to check that the Configuration Manager lists your project as 'Debug', not 'Release' (use the drop-down box on the standard menu to alter, or choose Build, Configuration Manager).
- When you created the project, did you specify an IP address rather than a machine name? If so, launch Internet Explorer, choose Internet Options, select the Security tab and add the IP address to the list of trusted sites—then try again.
- Did you install IIS after Visual Studio .NET? If so, you'll need to do a little fixing. Use the Help Index to look up "installing Internet Information Server". Midway through the software requirements, you'll find instructions telling you how to install IIS. It also provides advice on configuring and repairing IIS after installing Visual Studio .NET: Follow the guidelines.
- Are the IIS security settings set up properly? You can check this by launching the Internet Services Manager in Windows 2000, or Internet Information Services in Windows XP (found under the Administrative Tools option on the Programs menu). Navigate to your Web server, locate the Default Web Site node, right-click and select Properties, choose the Directory Security tab, and select Edit. Ensure Anonymous Access and Integrated Windows Authentication are checked, then OK on all open dialog boxes.
- Is the Web application virtual folder set up correctly? You can check this by launching the Internet Services Manager in Windows 2000, or Internet Information Services in Windows XP (found under the Administrative Tools option on the Programs menu). Navigate to your Web server, expand the Default Web Site node, and then find your application folder in the list. If it looks like regular Windows Explorer, it hasn't been set up correctly. To resolve, right-click on the folder, select Properties, click the Create button, and then hit OK to save.
- And finally, the most obvious of them all: Is the URL for the project correct? Ensure both directory and extensions are accurate—and attempt to browse the list of available files, where appropriate.
Coming Up in Part Five of Windows Secrets:
- Using .IsClientConnected for Long Processes
- What to Do When Session_End Doesn't Work
- Spy on Your Web Host: Checking Uptime in .NET
- Can It Cope?—Stress Testing Your Web Apps
See you then!
About the Author
Karl Moore is a technology author living in Yorkshire, England. He runs his own consultancy group, White Cliff Computing Ltd, and is author of two best-selling books exposing the secrets behind Visual Basic .NET. When he's not writing for magazines, speaking at conferences, or making embarrassing mistakes on live radio, Karl enjoys a complete lack of a social life. Check out Karl's newest book, Ultimate VB .NET and ASP.NET Code Book.
# # #