我正在写一个WCF服务需要模拟和会话.
我尝试在我的本地计算机上调用它时没关系,但是在远程计算机上它总是失败并出现这样的错误:
安全支持提供程序接口(SSPI)身份验证失败.服务器可能未在标识为"host/hostname"的帐户中运行.如果服务器正在服务帐户(例如,网络服务)中运行,请将该帐户的ServicePrincipalName指定为服务器的EndpointAddress中的标识.如果服务器在用户帐户中运行,请将该帐户的UserPrincipalName指定为服务器的EndpointAddress中的标识.
如果我提供了upn,它会抛出一个身份失败的异常.
这是我的配置:
服务器配置(APP):
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="default">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization impersonateCallerForAllOperations="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="DataService.netTcpBinding">
<readerQuotas maxArrayLength="65535" maxBytesPerRead="2147483647" maxStringContentLength="2147483647"/>
<reliableSession enabled="true" inactivityTimeout="24:00:00" ordered="true"/>
<security mode="TransportWithMessageCredential">
<message clientCredentialType="Windows" />
<transport clientCredentialType="Windows"/>
</security>
</binding>
</netTcpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<services>
<service behaviorConfiguration="default" name="DataService.DataService">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="DataService.netTcpBinding"
name="DataService.DataService" contract="DataService.IDataService"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://address:4504/"/>
<add baseAddress="net.tcp://address:4503/"/>
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
客户端配置:
<?xml version="1.0" encoding="utf-8" ?> …Run Code Online (Sandbox Code Playgroud)