日期:2014-05-17  浏览次数:20951 次

WCF- 访问远程服务SOAP错误
先谢过 再提问。 大侠问题如下:


1 服务其实很简单没什么 ,就是包含了加减乘除四个方法。服务的宿主是个windows service.
2 客户端就是利用服务利用svcutil导出的一个配置文件和元数据cs文件创建了一个客户端来调用服务方法。 但是本地没问题,一旦利用网络中另外一台计算机访问就报错 SOAP security negotiation with "http://../service" failed。

异常

System.ServiceModel.Security.SecurityNegotiationException: SOAP security negotiation with 'http://10.200.46.197:8000/ServiceModelSamples/service' for target 'http://10.200.46.197:8000/ServiceModelSamples/service' failed. See inner exception for more details. --->  
  at System.ServiceModel.Security.WindowsSspiNegotiation.Decrypt(Byte[] encryptedContent)
  at System.ServiceModel.Security.WSSecurityJan2004.WrappedKeyTokenEntry.CreateWrappedKeyToken(String id, String encryptionMethod, String carriedKeyName, SecurityKeyIdentifier unwrappingTokenIdentifier, Byte[] wrappedKey, SecurityTokenResolver tokenResolver)
  at System.ServiceModel.Security.WSSecurityJan2004.WrappedKeyTokenEntry.ReadTokenCore(XmlDictionaryReader reader, SecurityTokenResolver tokenResolver)

Inner Exception: 
System.ComponentModel.Win32Exception: The message or signature supplied for verification has been altered
  at System.ServiceModel.Security.WindowsSspiNegotiation.Decrypt(Byte[] encryptedContent)
  at System.ServiceModel.Security.WSSecurityJan2004.WrappedKeyTokenEntry.CreateWrappedKeyToken(String id, String encryptionMethod, String carriedKeyName, SecurityKeyIdentifier unwrappingTokenIdentifier, Byte[] wrappedKey, SecurityTokenResolver tokenResolver)
  at System.ServiceModel.Security.WSSecurityJan2004.WrappedKeyTokenEntry.ReadTokenCore(XmlDictionaryReader reader, SecurityTokenResolver tokenResolver)
  at System.ServiceModel.Security.WSSecurityTokenSerializer.ReadTokenCore(XmlReader reader, SecurityTokenResolver tokenResolver)
  at System.ServiceModel.Security.WSTrust.Driver.GetIssuedToken(RequestSecurityTokenResponse rstr, SecurityTokenResolver resolver, IList`1 allowedAuthenticators, SecurityKeyEntropyMode keyEntropyMode, Byte[] requestorEntropy, String expectedTokenType, ReadOnlyCollection`1 authorizationPolicies, Int32 defaultKeySize, Boolean isBearerKeyType)
  at System.ServiceModel.Security.RequestSecurityTokenResponse.GetIssuedToken(SecurityTokenResolver resolver, IList`1 allowedAuthenticators, SecurityKeyEntropyMode keyEntropyMode, Byte[] requestorEntropy, String expectedTokenType, ReadOnlyCollection`1 authorizationPolicies, Int32 defaultKeySize, Boolean isBearerKeyType)
  at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnNegotiationComplete(SspiNegotiationTokenProviderState sspiState, RequestSecurityTokenResponse negotiationRstr, RequestSecurityTokenResponse authenticatorRstr)
  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)
-----------------------------------

service app config 文件  

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
  <services>
  <service name="PubBaseService.CalcService"
  behaviorConfiguration="CalculatorServiceBehavior">
  <host>
  <baseAddresses>
  <add baseAddress="http://localhost:8000/ServiceModelSamples/service"/>
  </baseAddresses>