WF4 WorkflowServices Troubleshooting Tip: Browse the XAMLX

I was doing some work on my Contoso HR Workflow Services sample application today when for some strange reason things were not working at all.  I found that when I tried to send a message to the Workflow Service from the ASP.NET code I got this exception.

System.ServiceModel.CommunicationException was unhandled by user code
Message=The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

Setting a breakpoint didn’t help because the message never made it into the WorkflowService.  Event adding my WorkflowServiceTrace behavior didn’t yield any clues.  And then I remembered my first rule of debugging a WorkflowService problem.

If you can’t get a message to the WorkflowService try browsing the XAMLX

Browsing the XAMLx is simple.  Just right click on the XAMLX and select View in Browser.

This causes the WorkflowServiceHost to launch, load the XAMLX and validate the activity tree.  If there is any error going on you will most certainly see it here and you will get the exact cause of the error.

My problem?

Cannot open database "WF4Persistence" requested by the login. The login failed.
Login failed for user 'REDMOND\rojacobs'.

I recently reset my system and I need to setup the SQL permissions again.  No big deal but if you don’t know what is causing the problem getting to the solution can sure be a pain.

Happy Coding!

Ron Jacobs
www.ronjacobs.com
twitter: @ronljacobs