Use VS2010 Remote Debugger For Debugging Workflow Plug-in MSCRM 4

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

  1. 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.

    MSCRM1.gif
     
  2. There you have to choose the appropriate msvsmon.exe file as determined by your server architecture (ia64/x64 or x86) and run it.
     
  3. 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).

    MSCRM2.gif
     
  4. 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).
     
  5. Then you should copy the PDB file (Debug database) for your assembly to the <system drive>\Program Files\Microsoft Dynamics CRM\Server\bin\assembly.
     
  6. Go back to your machine and in VS2010, set the breakpoint in your code for where you need to debug.
     
  7. Next go to Debug -> Attach to Process
     
  8. Then go to the msvsmon process in the server and go to Tools >> Options
     
  9. Copy the value of the server name

    MSCRM3.gif
     
  10. 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)

    MSCRM4.gif
    And Refresh the list.
     
  11. 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
     
  12. Now trigger the workflow from your CRM and wait.
     
  13. 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.

Good Luck

Up Next
    Ebook Download
    View all
    Learn
    View all