Lost almost half a day evaluating the best way to integrate our licensing with our corporate CRM. Why am I writing this? To hopefully save someone else’s half day.
After a glimpse at the SDK I figured out I wanted to use the CRM web services. They were simple, and had just the functionality I needed.
I wanted to try them quickly, so I:
- pointed my browser to http://localhost:5555/MSCRMServices/2006/crmservice.asmx
- clicked on Fetch
- Entered a valid Fetch XML and clicked invoke
500 Internal server error
The rest of the day was spent trying to figure that error. I decided there is a problem with the web interface, so I wrote a small C# function to try it:
CrmService s = new CrmService();
s.Credentials = new NetworkCredential(“administrator”, “admin”, “organization”);
// or s.Credentials = System.Net.CredentialCache.DefaultCredentials;
s.Url = “http://localhost:5555/mscrmservices/2006/crmservice.asmx”;
string a = s.Fetch(@”
<fetch mapping=’logical’>
<entity name=’account’><all-attributes/>
</entity>
</fetch> “);
MessageBox.Show(a);
Same Internal server error.
FireFox gave me some insights, which still didn’t help me figure out what’s wrong:
System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80041D1F.
at Microsoft.Crm.Platform.ComProxy.CRMQueryClass.ExecuteQuery(CUserAuth& Caller, String QueryXML)
at Microsoft.Crm.Sdk.SavedQueryServiceProvider.Execute(String fetchXMLString, ExecutionContext context)
at Microsoft.Crm.WebServices.CrmService.Fetch(String fetchXml)
At the end of the day, all the 500 Internal server errors and cryptic InteropService exceptions boiled down to permission problems. I was using the administrator account, which is not allowed to use CRM.
The problem here is not that CRM didn’t work correct. The problem is that both IIS and the COM exception were too cryptic. The 0x80041D1F is described on some sites, but it is a CRM specific HRESULT, not something that error lookup knows about.
I really hope this article saves your half a day so you can do something fun with it.