I am trying to retrieve the data from CRM(that is on virtual machine) using WCF Service(that is on Host computer). I am running into the below SecurityException intermittently at Service.RetrieveMultiple while I am debugging from Host and trying to connect to CRM.
Code:
QueryExpression queryIssue = new QueryExpression
{ EntityName = irpc_Issue.EntityLogicalName, ColumnSet = new ColumnSet(new String[] { "irpc_issueid", "irpc_issuename"}), Criteria = new FilterExpression() };
queryIssue.Criteria.AddCondition("irpc_issueid", ConditionOperator.Equal, issueGuid); data.Issue = new NameGuid(); data.Issue.Name = service.RetrieveMultiple(queryIssue).Entities.FirstOrDefault().Attributes["irpc_issuename"].ToString();
Exception Details:
System.ServiceModel.Security.MessageSecurityException: {"The token provider cannot get tokens for target 'http://irpc-dc/amgen/XRMServices/2011/Organization.svc'."}
InnerException: {"The NetworkCredentials provided were unable to create a Kerberos credential, see inner exception for details."} Source: mscorlib
Server stack trace:
at System.ServiceModel.Security.SecurityProtocol.GetToken(SecurityTokenProvider provider, EndpointAddress target, TimeSpan timeout)
at System.ServiceModel.Security.MessageSecurityProtocol.GetTokenAndEnsureOutgoingIdentity(SecurityTokenProvider provider, Boolean isEncryptionOn, TimeSpan timeout, SecurityTokenAuthenticator authenticator)
at System.ServiceModel.Security.SymmetricSecurityProtocol.TryGetTokenSynchronouslyForOutgoingSecurity(Message message, SecurityProtocolCorrelationState correlationState, Boolean isBlockingCall, TimeSpan timeout, SecurityToken& token, SecurityTokenParameters& tokenParameters, SecurityToken& prerequisiteWrappingToken, IList1& supportingTokens, SecurityProtocolCorrelationState& newCorrelationState)
at System.ServiceModel.Security.SymmetricSecurityProtocol.SecureOutgoingMessageCore(Message& message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
at System.ServiceModel.Security.MessageSecurityProtocol.SecureOutgoingMessage(Message& message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
at System.ServiceModel.Channels.SecurityChannelFactory
1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, 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.IOrganizationService.RetrieveMultiple(QueryBase query) at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.RetrieveMultipleCore(QueryBase query) at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.RetrieveMultiple(QueryBase query)
I have run the SETSPN command on Guest (SETSPN -A HTTP/irpc-dc IRPC\CrmService ) by referring to the thread here http://social.microsoft.com/Forums/en-US/crm2011beta/thread/132a6d26-04fc-4e1e-8a7e-06088e106578
Still I am running into this Exception.
I am wondering if anybody are running into the same error.
Any help/ suggestions on this would be appreciated.
Thanks