【发布时间】:2011-01-18 08:15:26
【问题描述】:
以下是我的 WCF 服务的绑定配置。
- 匿名访问:关闭
- 基本认证:开启
- 集成 Windows 身份验证:关闭!
支持 HTTP 协议。
我在访问 WCF 服务时遇到以下异常:
此服务的安全设置需要“匿名”身份验证,但托管此服务的 IIS 应用程序未启用它。
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MyBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType ="Basic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="WMWcfWebServiceLib.Service1Behavior"
name="WMWcfWebServiceLib.WMWcfWebService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="MyBinding"
contract="WMWcfWebServiceLib.IWMWebService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/Design_Time_Addresses/WMWcfWebServiceLib/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WMWcfWebServiceLib.Service1Behavior">
<!-- 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>
请帮忙!!
编辑
我可以通过 Web 浏览器访问 WCF 服务,并进行以下更改:
将安全模式更改为 TransportCredentialOnly 并删除了 Mex 端点,但现在很明显我无法在客户端创建代理。
请让我知道我哪里错了?
【问题讨论】:
-
服务是否托管在 IIS 中?
-
您如何访问该服务?如果使用你的配置,它应该只支持 HTTPS。
-
我只想支持 HTTP,那我应该改变我的配置吗?
标签: wcf wcf-binding wcf-security