【发布时间】:2020-11-16 12:25:11
【问题描述】:
我们目前正在将旧 WCF 应用程序的服务迁移到新域中的服务器。由于迁移,以下提到的错误时有发生。
发生异常...
异常详细信息:服务器已拒绝客户端凭据。
System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]:服务器已拒绝客户端凭据。 (Fault Detail等于An ExceptionDetail,可能由IncludeExceptionDetailInFaults=true创建,其值为:
System.ServiceModel.Security.SecurityNegotiationException:服务器已拒绝客户端凭据。
System.Security.Authentication.InvalidCredentialException:服务器已拒绝客户端凭据。
System.ComponentModel.Win32Exception:登录尝试失败 --- 内部 ExceptionDetail 堆栈跟踪结束 ---
在 System.Net.Security.NegoState.ProcessReceivedBlob(Byte[] message, LazyAsyncResultlazyResult)
在 System.Net.Security.NegoState.StartSendBlob(字节 [] 消息,LazyAsyncResultlazyResult)
在 System.Net.Security.NegoState.StartSendBlob(字节 [] 消息,LazyAsyncResultlazyResult)
在 System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResultlazyResult)
在 System.Net.Security.NegotiateStream.AuthenticateAsClient(NetworkCredential credential, String targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel)
在...)。
困难的是,所有呼叫在 95% 的时间内都可以正常工作,而且呼叫突然失败并没有明显的原因。
配置和调用如下所示:
来电者:
<binding name="Binding_ServiceTCP"
closeTimeout="00:30:00" openTimeout="00:30:00"
receiveTimeout="infinite" sendTimeout="infinite"
transferMode="Buffered" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
<readerQuotas maxDepth="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"
maxStringContentLength="2147483647" />
</binding>
<Channel ChannelType="IWcfInterface" Name="ServiceName"
Binding="Binding_ServiceTCP" Address="net.tcp://serverinnewdomain:59886/Service" Identity="" />
objectOfIWcfInterfaceImplementingClass.WcfCall();
收件人:
<service behaviorConfiguration="BehaviourName" name="ServiceName">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="Binding_ServiceTCP" contract="IWcfInterface" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://serverinnewdomain:59886/Service" />
</baseAddresses>
</host>
</service>
<behavior name="BehaviourName">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
<binding name="Binding_ServiceTCP"
closeTimeout="00:30:00" openTimeout="00:30:00"
receiveTimeout="infinite" sendTimeout="infinite"
transferMode="Buffered" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
<readerQuotas maxDepth="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"
maxStringContentLength="2147483647" />
</binding>
[ServiceContract(Namespace = "http://some.cool/namespace")]
[XmlSerializerFormat]
public interface IWcfInterface
{
[OperationContract]
[XmlSerializerFormat(SupportFaults = true)]
SomeClass WcfCall();
}
实现是通过城堡注册的。
container.Register(Component.For<IWcfInterface>().ImplementedBy<WcfClass>().LifeStyle.PerWcfOperation());
在旧服务器上安装 .NET 4.7,在新服务器上安装 4.8。
怀疑凭据在从呼叫者到接收者的途中丢失了,我联系了网络团队,但他们告诉我这是不可能的。
我想查看哪些凭据到达服务。如果这是不可能的,我也会对任何其他解决方案感到满意。
【问题讨论】: