很抱歉重新发布,但我正在努力将我在其他帖子中读到的内容应用于我的问题。
我有一个自托管的 WCF 服务,当托管在我的计算机上且客户端位于我的计算机上时,该服务运行良好。
我尝试将客户端移至另一台计算机,但现在收到“调用者未经服务验证”错误。
请有人建议问题发生在哪里。
如果您需要更多信息,请告诉我。
亲切的问候
Ember
这是我的机器上有效的客户端配置
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IDataCollector" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.1.74:8080/" binding="wsDualHttpBinding"
bindingConfiguration="WSDualHttpBinding_IDataCollector" contract="AshService.IDataCollector"
name="WSDualHttpBinding_IDataCollector">
<identity>
<userPrincipalName value="Ash-PC\Ash" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
这是服务器配置
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IDataCollector" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service name="DataCollector">
<endpoint address="http://192.168.1.74:8080" binding="wsDualHttpBinding"
bindingConfiguration="WSDualHttpBinding_IDataCollector" contract="IDataCollector" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
最佳答案
您的问题是由 Windows 身份验证引起的,这是正确的。正如 Rest Wing 所描述的,如果您想使用服务有权访问的 AD 凭据,您必须提供这些凭据,以便服务对客户端进行身份验证。
如果您无法使用 Windows 身份验证并且您必须对客户端进行身份验证,则您将需要查看其他身份验证技术。一种方法是用户名/密码,但您需要建立自己的身份验证算法。另一个是证书;服务器和客户端必须安装证书(X509 证书有效)才能相互识别。还有其他方法,但如果我没记错的话,只有上述两种方法适用于不在同一域中的计算机。
如果您不需要验证客户端,请将安全模式设置为“无”。这将是一种通过互联网提供公开服务的技术。
关于c# - 调用者未经服务验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4968694/