I lost two days of my life over strange error in MS CRM in the past days.
(Almost) nothing changed on the production server of one of our clients but, MS CRM went koo-koo every time plug-in kicked in and tried to do something on update message. I got different errors – with one plug-in (Celenia CRM Connector) I got “Object reference not set to an instance of an object”, with some other plug-in I got “401: Unauthorized” error. I checked everything and then everything again, but no luck.
As a last resort I decided to write new plug-in and put some debugging code in. New plug-in that did little – it catched the update message and then retrieved current entity through web service.
I got 404… Click! This made me check if http://localhost points to MS CRM web site. It didn’t.
I dug deeper and realized that fully patched (Rollup 5) MS CRM has a strange bug (feature?) in context.CreateCrmService() method. This method is called inside plug-in and plug-in always runs on the server. To the web service always points to http://localhost[:port], which in my case, was terribly wrong.
After I restored the empty host header in my web site everything returned to normal.
I lost two days over couple of clicks. How typical!