SOAP安全协商调用Microsoft Dynamics CRM 2011 sdk IOrganizationServiceProxy Web服务时出错

时间:2012-10-25 10:30:35

标签: soap dynamics-crm-2011

我们公司有一个虚拟机,其中包含sqlserver和crm 2011,我们用它来测试我们的代码,我编写了一个简单的web服务来调用sdk IOrganizationServieProxy webservice。在这个虚拟机上,我的代码完全没有错误。但情况如下:我们有两个其他虚拟机,其中一个安装了sql server,另一个安装并配置了crm。 crm工作正常,但是当我尝试使用调用crm sdk IOrganizationServieProxy webservice webmethods的web服务时,我得到以下错误,任何想法可能出错?提前感谢任何回答这个问题的人。

    System.ServiceModel.Security.SecurityNegotiationException: SOAP security negotiation with 'http://localhost/KN/XRMServices/2011/Organization.svc' for target 'http://localhost/KN/XRMServices/2011/Organization.svc' failed. See inner exception for more details. ---> System.ComponentModel.Win32Exception: The Security Support Provider Interface (SSPI) negotiation failed.
   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)
   --- End of inner exception stack trace ---

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.IOrganizationService.RetrieveMultiple(QueryBase query)
   at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.RetrieveMultipleCore(QueryBase query)
   at KNCRMSearchWebService.searchContactsByNameAndFamilyName(String cl, String Name, String Family)

这是我的visualstudio调试模式中显示错误的图像:

enter image description here

1 个答案:

答案 0 :(得分:3)

它可能不适用,但是当我使用的URL与CRM部署管理器中设置的WCF绑定不匹配时,我遇到了问题。

例如,名为“MyCRMServer”的服务器可能正在端口80上侦听:

http://MyCrmServer/

...但如果我将部署管理器中的CRM服务器更改为url“crm.myCompany.com”,那么我必须使用此URL访问Web服务:

http://crm.myCompany.com/