Tuesday, February 7, 2012

Unhandled Exception: System.ServiceModel.Security.SecurityNegotiationException: SOAP security negotiation in MS CRM 2011, Plugin Registration tool

I got a weired exception while using and creating a connection in plugin registration tool.
this happens for online as well as for onpremise.
The exception is as follows...
---------------------------------------------------------------------------------------------------------------------------
Unhandled Exception: System.ServiceModel.Security.SecurityNegotiationException: SOAP security negotiation with 'http://xrm:5555/XRMServices/2011/Discovery.svc' for target 'http://xrm:5555/XRMServices/2011/Discovery.svc' failed. See inner exception for more details.

Server stack trace:
at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)


Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Xrm.Sdk.Discovery.IDiscoveryService.Execute(DiscoveryRequest request)
at Microsoft.Xrm.Sdk.Client.DiscoveryServiceProxy.Execute(DiscoveryRequest request)
at PluginRegistrationTool.CrmConnection.RetrieveOrganizations() in C:\Users\Administrator\Desktop\MSCRM2011_SDK\tools\pluginregistration\CrmConnection.cs:line 315
at PluginRegistrationTool.ConnectionsForm.OpenConnection(CrmConnection con) in C:\Users\Administrator\Desktop\MSCRM2011_SDK\tools\pluginregistration\ConnectionsForm.cs:line 940
Inner Exception: System.ComponentModel.Win32Exception: Security Support Provider Interface (SSPI) authentication failed. The server may not be running in an account with identity
'ADMINISTRATOR@mscrm.com'. If the server is running in a service account (Network Service for example), specify the account's ServicePrincipalName as the identity in the EndpointAddress for the server. If the server is running in a user account, specify the account's UserPrincipalName as the identity in the EndpointAddress for the server.
at System.ServiceModel.Security.WindowsSspiNegotiation.GetOutgoingBlob(Byte[] incomingBlob, ChannelBinding channelbinding, ExtendedProtectionPolicy protectionPolicy)
at System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState)
at System.ServiceModel.Security.IssuanceTokenProviderBase`1.GetNextOutgoingMessage(Message incomingMessage, T negotiationState)
at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan
timeout)

---------------------------------------------------------------------------------------------------------------------------

Reason
The line of exception was from the "ConnectionsForm.cs" file of the pugin registration tool and the line of code was
"RetrieveOrganizationsResponse response = (RetrieveOrganizationsResponse)this.DiscoveryService.Execute(request); "
The password for the admin user was of length more than 15, characters :P
Shorten the password, then it will run smoothly.

Note: If the paswword is that much large, it does have impact on MS CRM access or any other sdk code uses or plugin code as well.

thanks,
yes.sudhanshu

No comments:

Post a Comment