Monday, March 21, 2011

Fixed: Microsoft CRM 2011 WCF Timing Issue When Making Web Service Calls

I have periodically ran into the following exception on my CRM 2011 virtual dev machine:

System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---> System.ServiceModel.FaultException: An error occurred when verifying security for the message.

I have found ways to work around this now every time I have ran into it.
I have noticed another Exception with the same cause before when working with the CrmSvcUtil.exe tool. 

Cause: Timezone or time being wrong on the client or server. 

Resolution: Correct date and time settings on affected machine, also restart client application making call

Example Post Illustrating: http://social.msdn.microsoft.com/Forums/is/wcf/thread/d7a13c9b-2144-4b0d-9585-5a487126ab1f

I had to restart Visual Studio on the client machine after I fixed the time on the server for my calls to function properly.

I hope this helps!

7 comments:

  1. Thanks! This helped me out a lot. I was getting this error from custom WCF services being called between two Microsoft CRM servers.

    SOAP security negotiation with 'http://localhost:5555/crm2/XRMServices/2011/Organization.svc' for target 'http://localhost:5555/crm2/XRMServices/2011/Organization.svc' failed. See inner exception for more details.

    This error didn't happen at first and then would happen only some of the time and then all of the time. The two CRM servers were both VM images, hosted on different boxes.

    I sync'd the system time on the two boxes with the domain controller and the problem went away. This saved me a lot of headache. Thanks!!

    glenn.

    ReplyDelete
  2. I am glad you found this helpful. The WCF bindings only allow a 5 minute maximum discrepancy when you convert the time to GMT or Zulu time based on TimeZone settings.

    I have also seen where you can fall an hour off as a result of not having the setting for the auto-adjust for daylight savings time be the same for your client and server.

    It can get pretty annoying. Not all WCF bindings have this discrepancy, but the ones for the WCF endpoints in CRM 2011 do.

    ReplyDelete
  3. i got the same issue BUT i have to deal with crm 2011 online. so i dont have access to the timesetting of the crm-server. i allready changed the timezone of my biztalk but no effect.
    any other ideas?

    greetz Claus

    ReplyDelete
  4. You will need to find out the setting information so you can make sure you are in sync with the server.

    ReplyDelete
  5. Thank you!!

    In my case, I had to synchronize the timeSettings in the machineDomain controller and the CRM server (the WCF service is hosted in the CRM server)

    Thank you again

    ReplyDelete
  6. We are really trust on the online crm software where we can take a look of our enployee There are important sales lead follow up ideas which all be helpful and there you can get the chance to learn and implement the web based crm software in bets of ways. There are many cases when the CRM tool

    ReplyDelete