gpt4 book ai didi

c# - 未提供用户名。在 ClientCredentials 中指定用户名

转载 作者:太空狗 更新时间:2023-10-29 20:30:45 24 4
gpt4 key购买 nike

我使用客户端凭据创建 WCF 应用程序。它在内部工作正常,而我从其他项目引用和调用此服务意味着我收到了错误消息。

The username is not provided. Specify username in ClientCredentials.

请帮我解决这个问题。

<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IWcfService" 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"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://wcfauthtest.sbs.in:448/WcfService.svc/WcfService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IWcfService"
contract="AuthTest.IWcfService" name="WSHttpBinding_IWcfService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>

有什么帮助吗?

最佳答案

您是否在客户端/消费者端指定了凭据:

WcfService.UserName.UserName = "user";
WcfService.UserName.Password = "pass";

在您的代码中对 WCF 服务进行任何调用之前,您应该提供这些凭据。

关于c# - 未提供用户名。在 ClientCredentials 中指定用户名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21983178/

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