How to test that Xrm.XrmDataContext connection is operational RRS feed

  • Question

  • Hi I have a data synchronization application that passes data between 3 or 4 different applications CRM being one of them using a queue. I am using the    XrmDataContext object for my CRM updates like this           

    XrmDataContext crm;
    crm = new Xrm.XrmDataContext("Crm"); 

    I want to test that the "Crm" connection is good and valid e.g. no 500 or 400 errors before I pop the message from the queue. Is there any method in XrmDataContext that allow me to do that?

    Monday, March 19, 2012 2:26 PM

All replies

  • Thank you pogo. Our server is not multi-homed. We also don't want a port number for the CRM website. So can we have CRM as the default website on 443 and ADFS on a non-default website on for instance port 444? Will ADFS still work without any extra steps from the client?
    artigo apresentar
    Monday, March 19, 2012 4:46 PM
  • say what?
    Monday, March 19, 2012 9:38 PM
  • Not that I know of, other than running a minimal query to test connectivity.  Perhaps something like a WhoAmIRequest?

    using (var xrm = new Xrm.XrmDataContext("Crm"))
    	WhoAmIRequest req = new WhoAmIRequest();
    	WhoAmIResponse resp = (WhoAmIResponse)xrm.Execute(req);
    Trap it inside a try/catch and test for the existence of your returned User GUID.

    --pogo (pat) @ pogo69.wordpress.com

    Tuesday, March 20, 2012 2:30 AM
  • Spooky.  I've a feeling the answer above is referring to me, but I've no idea in reference to what?  Errant mouse-click I suspect.

    --pogo (pat) @ pogo69.wordpress.com

    Tuesday, March 20, 2012 2:32 AM