18 October 2007

Visual Studio Debugging websites that require client certificates

Just when I was too confident about my Visual Studio F5 skills I encountered the devil :)  Not a very common scenario but consider you are developing a website off an IIS server and you need to debug it. The only catch is that the website is configured to require client certificates on IIS.

The most important requirement for the pretty F5 key to work in Visual Studio is NTLM/Windows Intergated Authentication. Only then can it auto-attach to the IIS worker process. And this is where our trouble starts. Client certificates is a kind of an authentication mechanism. When you configure a website to require client certificates you are changing the authentication mechanism.

So if you are developing a website off an IIS server and you need to debug it with client certificates then you cannot just open your web project in visual studio and start debugging it. But what you can do is attach to the process running your code manually.  

Open your project in Visual Studio and set a breakpoint as you usually do

Debug menu > Attach to Process > Select the process running your code.

Open a browser and browse to that particular page where you set the breakpoint and vola! the debugger will break into the code..

If you have multiple worker processes (w3wp.exe) use the iisapp.vbs script to figure out which process is running your code.

Bookmark and Share
Filed under:
 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

Comment Policy: No HTML allowed. URIs and line breaks are converted automatically. Your e–mail address will not show up on any public page.

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Page view tracker