Wednesday, March 30, 2011

Attach Visual Studio to an application using Powershell

This script can be used to run the Visual Studio just in time debugger for debugging your website. It gets the name of the application pool running the website and then attach the JIT to the w3wp process.

$filter = "*MyWebsite*"

$w3wp = get-WmiObject Win32_Process -Filter "Name='w3wp.exe'"
$prid = $w3wp | where { $_.CommandLine -like $filter }

c:\Windows\System32\vsjitdebugger.exe -p $prid.ProcessId

No comments:

Post a Comment