匿名身份验证不适用于WCF服务:“quot;。。。。。从服务器接收的身份验证标头为''&引用;
我们使用IIS 7.5托管内部网应用程序,这些应用程序配置为使用Windows身份验证 在其中一个应用程序中,我有一个WCF服务,我正试图托管/调用它。这必须具有匿名身份验证,因此我可以使用以下设置托管它:匿名身份验证不适用于WCF服务:“quot;。。。。。从服务器接收的身份验证标头为''&引用;,wcf,authentication,iis,iis-7.5,Wcf,Authentication,Iis,Iis 7.5,我们使用IIS 7.5托管内部网应用程序,这些应用程序配置为使用Windows身份验证 在其中一个应用程序中,我有一个WCF服务,我正试图托管/调用它。这必须具有匿名身份验证,因此我可以使用以下设置托管它: <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="myServiceBehaviour">
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="myServiceBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingOverSslAnonymous">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service behaviorConfiguration="myServiceBehaviour"
name="xxx.yyy.Web.Mvc.Client.Services.MyService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingOverSslAnonymous" name="BasicHttpEndpoint" contract="xxx.yyy.Wcf.IMyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
但是,尽管服务器配置为允许匿名身份验证和禁用Windows身份验证,但我得到的只是以下异常消息:
HTTP请求未经客户端身份验证方案授权
“匿名”。从服务器接收的身份验证标头为“”
注意空的身份验证头。用谷歌搜索是徒劳的,因为所有的回复都有引文(尽管使用了短语搜索操作符)
这基于具有以下配置的我的客户端:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpoint">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://xxx.local/xxx.yyy.Web.Mvc.Client/services/MyService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpoint"
contract="MyService.IMyService" name="BasicHttpEndpoint" />
</client>
</system.serviceModel>
在浏览器中打开Windows身份验证可以正常工作,但我不想发送凭据
好像WCF正在忽略我的IIS配置:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpoint">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://xxx.local/xxx.yyy.Web.Mvc.Client/services/MyService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpoint"
contract="MyService.IMyService" name="BasicHttpEndpoint" />
</client>
</system.serviceModel>
- 匿名认证
- 模仿
- 基本身份验证
- 表单身份验证
- Windows身份验证
有趣的是,在匿名设置下,将test.txt文件放到同一个文件夹中效果很好。似乎这只会影响WCF。问题在于,在IIS中配置匿名身份验证并不是唯一的步骤 以下内容将从包含“我的服务”的/Services文件夹中删除intranet样式的拒绝规则
<location path="Services">
<system.web>
<authorization>
<allow users="*" />
</authorization>
<identity impersonate="false" />
</system.web>
</location>
这样做的净效果是,/Services文件夹中的.net资产允许进行匿名身份验证。这是在哪个文件中设置的?啊,很抱歉,was
Web.config
感谢您对旧线程的评论回复。这是服务web.config还是在IIS目录中?没问题。服务web.config,因此适用于应用程序。