Partager via


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