This might be useful for people working with MSCRM and writing custom workflow activities for it. There's no other way to debug that code unless we use a remote debugger in VS2010.
So we'll go Step by Step
- On your server (Machine where MSCRM is installed and running) you should first go to Program Files>>Microsoft Visual Studio 2010>>Visual Studio Tools>>Visual Studio 2010 Remote Debugger.
- There you have to choose the appropriate msvsmon.exe file as determined by your server architecture (ia64/x64 or x86) and run it.
- Now click Tools -> Permissions and give access to it for your user account. (If you are running with a firewall it will ask to configure the firewall settings - do it - you can easily figure it out).
- Now register your plug-in the MSCRM with the plug-in registration tool. (How to do a plug-in registration is off-topic for this article; if you want to learn it, visit http://msdn.microsoft.com/en-us/library/gg309580.aspx).
- Then you should copy the PDB file (Debug database) for your assembly to the <system drive>\Program Files\Microsoft Dynamics CRM\Server\bin\assembly.
- Go back to your machine and in VS2010, set the breakpoint in your code for where you need to debug.
- Next go to Debug -> Attach to Process
- Then go to the msvsmon process in the server and go to Tools >> Options
- Copy the value of the server name
- Come back to your machine and set the fallowing values there
Transport >> Default
Qualifier >> value of the server name (you just copied at the step 9)
And Refresh the list.
- Now select the process you need attach to:
An online plug-in >> attach the debugger to the w3wp.exe process
An offline plug-in >> attach the debugger to the Microsoft.Crm.Application.Hoster.exe process
Asynchronous registered plug-ins >> attach to the CrmAsyncService.exe process
Custom workflow activity >> attach to the CrmAsyncService.exe process
- Now trigger the workflow from your CRM and wait.
- Oops! Nothing is happening!! Please be patient. Remember this is an asynchronous service so it will take some time to actually start your process. You will get there soon.