Rick Strahl's Web Log

Wind, waves, code and everything in between...
ASP.NET • C# • HTML5 • JavaScript • AngularJs
Contact   •   Articles   •   Products   •   Support   •   Search
Ad-free experience sponsored by:
ASPOSE - the market leader of .NET and Java APIs for file formats – natively work with DOCX, XLSX, PPT, PDF, images and more

IIS 7 Integrated Pipeline Debugging, Visual Studio 2005 SP1 and Request Tracing


:P
On this page:

Visual Studio Service 2005 Pack 1 provides the ability to hook up to IIS 7 and use the debugger properly in Integrated Pipeline mode, which previously caused errors. Or so they say <s>... Integrated pipeline in IIS 7 runs the IIS and ASP.NET event pipeline through a single model rather than the previous ISAPI mode which essentially used two completely separate engines interacting with each other. With the Integrated Pipeline request processing for IIS and ASP.NET is consolidated into a single mechanism that is extensible using familar ASP.NET Modules and Handlers – with the big advantage that you can now write these modules and handlers to extend the Web Server as a whole. This basically provides functionality that previous required ISAPI Handlers and Filters – something that you simply couldn’t do easily before with .NET code.

 

IIS 7 ships with Vista and the forth coming LongHorn Server (later next year). If you’re running Vista you can play with the Integrated Pipeline today. Note the Integrated Pipeline is the default, but you can still run IIS in the familiar ISAPI mode that works exactly the same as it did on IIS. Most ASP.NET applications can run in either mode without any changes.

 

If you want to use Integrated mode and debug, prior to VS 2005 SP1 you had to manually attach a debugger to debug your applications. You had start the Web application by hitting your site and then finding the appropriate W3WP.EXE instance to attach to. If you had more than one instance of  worker processes running this was a bit tedious and the whole manual attachment issue was tediuous enough to avoid using integrated mode for anything but code that actually took advantage of Integrated pipeline functionality (which at this point is probably not much).

 

With Visual Studio 2005 SP1 this issue is addressed and you can directly start an IIS 7 Integrated Pipeline project from within the IDE, which is great.

 

Problems, problems... and some solutions

Great if it works – not so great if it doesn’t and it’s VERY EASY for something to go wrong here as you’ll see in a minute. Before you start debugging make sure you can just get the site to run in Integrated mode. There are a few changes that need to be made in web.config in order for an Integrated Site to run. They are minor – the main thing is that any handlers and modules need to be moved to the new <system.webserver> section of the web.config file:

 

<configuration>

  <system.web>

    <!--<httpHandlers>

      <add path="ChatHandler.ashx" type="ChatService" verb="GET,POST" />       

    </httpHandlers>-->

  </system.web>

  <system.webServer>

    <handlers>

      <add name="ChatHandler" path="ChatHandler.ashx" type="ChatService" verb="GET,POST" />

    </handlers>

    <modules>

    </modules>

  </system.webServer>

</configuration>

 

So I was a little overeager earlier and DIDN’T check the app first and went straight ahead to trying to debug the app which got me an error dialog:

 

---------------------------

Microsoft Visual Studio

---------------------------

Unable to start debugging on the web server. Debugging failed because integrated Windows authentication is not enabled. Please see Help for assistance.

---------------------------

 

And yes it’s very important to make sure that you enable Windows Authentication in your site in order for debugging to work (this is true for IIS in general). Since I already use IIS for debugging this was not the problem for me.

 

The first site I tried this on is a my wwHoverPanel samples, which is pretty simple. And it’s definitely not an authentication issue since the site runs just fine with the integrated pipeline. So after screwing around with the settings in the IIS manage for a while I realized I should really look at this from the source:

 

IIS 7 includes a highly useful feature called Failed Request Tracing  which when turned on gives you a detailed accounting of the last n specified number of failed requests. This option can be enabled on the Web Server or as a whole or on an individual application and you can specify what errors to log and even which request you want to trace (excellent if you know exactly what the problem request is). The output is dumped into a directory of XML files which includes an XSL stylesheet for formatting. When you do, you get a rather useful error trace that looks like this:

 

 

(actually the failure is further down in the list but any warnings or errors are summarized above).

 

In this case you can see that it points at a configuration error in the site and the page that the debugger is apparently trying to hit (debugattach.aspx). Now you can take that page and run it in the browser, and at that point you get a whole bunch of useful error information that points – in this case – at the HttpHandler section not having been migrated to the <system.webServer> section of the web.config file.

 

If I had tried to run this site first before trying to debug it, I would have found this out immediately without going through the the trace, but hindsight is always… .

 

The key thing to remember here is that you’ll get an authentication error apparently on ANY KIND of error, so don’t assume it’s an authentication error just because it says so <s>

 

More problems and – but no Solution

Ok so one problem solved another to go. Originally I had tried this on my West Wind Web Store which is fairly complex application. And unfortunately – even with Failed Request Tracing – I’ve not been able to get to debug under Integrated mode.

 

The site runs just fine in Integrated mode, but it will not debug. On this site though I DO actually get an authentication error:

IIS Trace Detail Highlights

No.

EventName

Details

Time

23.

n

n

r

MODULE_SET_RESPONSE_ERROR_STATUS
Warning

ModuleName="global.asax", Notification="BEGIN_REQUEST", HttpStatus="401", HttpReason="Unauthorized", HttpSubStatus="0", ErrorCode="The operation completed successfully. (0x0)", ConfigExceptionInfo=""

09:00:24.861

 

What’s interesting though is that the site runs, which means that Windows Authentication is definitely enabled – just to ensure that this is the case I removed the IUSR_ account from the site and sure enough when I run the site it authenticates.

As you can see here authentication fails on trying to read global.asax and FREB reports that authentication is not even available:

IIS Diagnostics Output

Url:

http://rasvista:80/wwstore/default.aspx

Site:

1

App Pool:

DefaultAppPool

Process:

2560

Authentication:

NOT_AVAILABLE

User:

User from token:

Activity ID:

{00000000-0000-0000-1400-0080010000FE}

Failure Reason:

STATUS_CODE

Final Status:

401

Time Taken:

 

Which I don’t get. If that was the case the site would not work. And – if I cause a 404 with an invalid URL I do see the authentication:

IIS Diagnostics Output

Url:

http://rasvista:80/wwstore/defaults.aspx

Site:

1

App Pool:

DefaultAppPool

Process:

2560

Authentication:

NOT_AVAILABLE

User:

User from token:

Activity ID:

{00000000-0000-0000-1F00-0080000000DD}

Failure Reason:

STATUS_CODE

Final Status:

401.2

Time Taken:

0 msec

 

I figured maybe this has something to do with the account that is trying to debug, but I even added Everyone to this folder just in case to see if this would make a difference – but no luck…

 

I’ve mucked around with the permissions, tried to ensure they match with the sample that works, I’ve compared the modules installed made sure that Authentication is indeed enabled – heck I even disabled all other authentication mechanisms (and turned the back on to the default). None of that has any effect. This damn app just does not want to debug under Integrated mode.

 

I’m giving up for the night…

 

Posted in IIS  

The Voices of Reason


 

# DotNetSlackers: IIS 7 Integrated Pipeline Debugging, Visual Studio 2005 SP1 and Request Tracing


Visual Studio 2005
December 26, 2006

# ASP.NET Forums - Problem debugging an Integrated Pipeline Application with SP1


Mike Volodarsky
December 27, 2006

# re: IIS 7 Integrated Pipeline Debugging, Visual Studio 2005 SP1 and Request Tracing

Hey Rick,

It sounds like you have two problems. First, you have some code in your global.asax that may be expecting some authentication information in BeginRequest, whereas in Integrated mode thats much too early to have it (it gets computed in AuthenticateRequest by whatever IIS/ASP.NET authentication modules you have enabled).

The other problem you are running into is a bug in the debugger attaching component in Integrated mode. If you have any modules running prior to AuthenticateRequest (like your global.asax), it will fail to attach ... This is very unfortunate ... I am working on a workaround, probably get some info on www.mvolo.com later this week.

Mike

Mike Volodarsky
December 28, 2006

# re: IIS 7 Integrated Pipeline Debugging, Visual Studio 2005 SP1 and Request Tracing

I posted the detailed instructions on how to get F5 debugging of Integrated mode ASP.NET applications to work on Vista (includng your specific case). You can get the low-down at http://mvolo.com/blogs/serverside/archive/2006/12/28/Fix-problems-with-Visual-Studio-F5-debugging-of-ASP.NET-applications-on-IIS7-Vista.aspx.

Let me know if this works for you.

Mike

Rick Strahl
December 29, 2006

# re: IIS 7 Integrated Pipeline Debugging, Visual Studio 2005 SP1 and Request Tracing

Thanks a bunch Mike! Yup that's exactly the problem. Disabling my BeginRequest hook in global.asax makes the app start in the debugger. Using your helper module lets me work with the app. Thanks for this helper!!!

Eric Deily
January 02, 2007

# re: IIS 7 Integrated Pipeline Debugging, Visual Studio 2005 SP1 and Request Tracing

Hey Rick -
in your FREB xml file, are there authentication events logged? Look for AUTH_REQUEST_AUTH_TYPE & AUTH_SUCCEEDED (hopefully) in the FREB file to see if authentication succeeded. Based on what Mike told me (his office is just around the corner), one thing that could cause this issue is that NTLM (windows integrated) isn't installed and therefore the type of auth being requested fails. Another problem could be the bug Mike mentions, which when fixed will show the right auth credentials.

-ericde (I own the failed req tracing feature).

ASP.NET Forums
May 20, 2007

# Problem debugging an Integrated Pipeline Application with SP1 - ASP.NET Forums


Rick Strahl's Web Log
May 27, 2007

# IIS 7 Integrated Pipeline Debugging on Vista, again - Rick Strahl's Web Log

Mike Volodarsky posts more information how to get F5 debugging working properly in Visual Studio. Due to the way Authentication works in ASP.NET 2.0 some debugging scenarios with F5 fail and a workaround is required.

Tangible Thoughts
July 04, 2007

# VS2005 Web Debugging in Vista


Rupak Ganguly
May 06, 2008

# re: IIS 7 Integrated Pipeline Debugging, Visual Studio 2005 SP1 and Request Tracing

I had other issues with Vista SP1, VS 2005 and IIS 7 and I have written a post here http://developershelf.blogspot.com/2008/05/problem-loading-iis7-hosted-wap.html
 

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2019