问题描述
我正在尝试从客户端控制台应用程序访问服务器上的 WCF 服务以进行测试.我收到以下错误:
I am trying to access my WCF service on a server from my client console application for testing. I am getting the following error:
调用者未经认证服务
我正在使用 wsHttpBinding
.我不确定服务需要什么样的身份验证?
I am using wsHttpBinding
. I'm not sure what kind of authentication the service is expecting?
<behaviors>
<serviceBehaviors>
<behavior name="MyTrakerService.MyTrakerServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
更新如果我将绑定更改为 <endpoint "basicHttpBinding" .../>
(来自 wsHttpBinding)在托管的 IIS 7.0 上,Windows 2008 服务器
UpdateIt works if I change my binding to <endpoint "basicHttpBinding" ... />
(from wsHttpBinding)on the IIS 7.0 hosted, windows 2008 server
推荐答案
如果您使用 basicHttpBinding,请将端点安全配置为None"并将 clientCredintialType 传输为None".
If you use basicHttpBinding, configure the endpoint security to "None" and transport clientCredintialType to "None."
<bindings>
<basicHttpBinding>
<binding name="MyBasicHttpBinding">
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="MyServiceBehavior" name="MyService">
<endpoint
binding="basicHttpBinding"
bindingConfiguration="MyBasicHttpBinding"
name="basicEndPoint"
contract="IMyService"
/>
</service>
另外,确保IIS中的目录Authentication Methods to Enable Anonymous access
Also, make sure the directory Authentication Methods in IIS to Enable Anonymous access
这篇关于WCF 错误:调用者未经服务验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!