gpt4 book ai didi

c# - 调用者未通过服务的身份验证

转载 作者:行者123 更新时间:2023-11-30 21:17:07 28 4
gpt4 key购买 nike

对于重新发布感到抱歉,但我正在努力将我在其他帖子中阅读的内容应用到我的问题中。

我有一个自托管的 WCF 服务,当托管在我的机器上并且客户端在我的机器上时,该服务运行良好。

我已尝试将客户端移动到另一台机器,但现在收到“调用者未通过服务进行身份验证”错误。

请有人告诉我问题出在哪里。

如果您需要更多信息,请告诉我。

亲切的问候

这是在我的机器上运行的客户端配置

<?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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com