安全设置需要匿名身份验证错误 [英] Security setting require Anon Authentication error

查看:128
本文介绍了安全设置需要匿名身份验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

平台:

Windows 7企业SP 1
带有WCF服务的.NET Framework 4…
IIS 7.5(托管WCF服务的Virt目录仅配置为Windows身份验证.禁用了匿名功能)
Silverlight V4客户端

错误:
当我尝试访问配置为使用Windows身份验证的WCF服务时(通过从Visual Studio中启动服务/主机Web项目,或者尝试通过IE(http://localhost/SecurityService .svc)是:

此服务的安全设置需要匿名"身份验证,但是承载此服务的IIS应用程序未启用该身份验证.

说明:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.

异常详细信息:System.NotSupportedException:此服务的安全设置需要匿名"身份验证,但未为承载此服务的IIS应用程序启用它.
WCF服务的Web配置为:

 <?  xml    版本  ="  ? > 
<  配置 > 
  <   system.web  > 
    <  编译    ="   true"  targetFramework   > 4.0"    / > 
    <  身份验证    ="   Windows" > 
  <  /system.web  > 
  <   system.serviceModel  > 
    <  行为 > 
      <   serviceBehaviors  > 
        <  行为 > 
          <!-  为避免公开元数据信息,请将以下值设置为否,并在部署之前删除上面的元数据终结点 ->  
          <   serviceMetadata     ="   false" > 
          <!-  要在故障中接收异常详细信息以进行调试,请设置下面的值为true.部署前设置为false以避免泄露异常信息 ->  
          <   serviceDebug     ="   false" > 
        <  /行为 > 
      <  /serviceBehaviors  > 
    <  /行为 > 
    <  绑定 > 
      <   basicHttpBinding  > 
        <  绑定    ="   AppHttpBinding"  maxBufferPoolSize   > 2147483647"     maxBufferSize   ="  2147483647"  maxReceivedMessageSize    2147483647" <   readerQuotas     ="   2147483647"  maxBytesPerRead   > 2147483647"     maxDepth   ="  2147483647"  maxNameTableCharCount    2147483647"  maxStringContentLength   ="    > 
          <  安全性    ="   TransportCredentialOnly" <  运输    ="   Windows" > 
          <  /security  > 
        <  /binding  > 
      <  /basicHttpBinding  > 
    <  /bindings  > 
    <  服务 > 
      <  服务   名称   Volpe.Services.SAS.Internal.Host.SecurityService" > 
        <  端点    ="   AppHttpEndpoint" 地址  " 
 
                     span>                 绑定   basicHttpBinding"    bindingConfiguration   ="  AppHttpBinding" 
                     span>                 合同   Volpe.Services .SAS.Internal.Contracts.Security.ISecurityService" / <  /service  > 
      <  服务   名称   Volpe.Services.SAS.Internal.Host.NotificationService" > 
        <  端点    ="  "   绑定  ="   ="span>    bindingConfiguration   ="  AppHttpBinding" 
                     span>          ="   Volpe.Services.SAS.Internal.Contracts.Notifications.INotificationService" > 
      <  /service  > 
    <  /服务 > 
    <   serviceHostingEnvironment     ="   true"  aspNetCompatibilityEnabled    true"   / > 
  <  /system.serviceModel  > 
  <   system.webServer  > 
    <  模块    ="   true" > 
  <  /system.webServer  > 
<  /configuration  >  


我当然多次搜索了此错误,并且看到了许多解决该错误的技术文章.大多数人将其归因于已定义了MEX端点.如您在上面的web.config中所看到的,没有定义这样的端点.似乎我们的解决方案框架中有一些特定的内容导致WCF运行时认为它需要对网站的匿名访问.我尝试通过尝试许多潜在的解决方案来对其进行调试.我什至下载了.NET Framework代码并逐步执行,但是仍然出现错误.

任何帮助将不胜感激.

谢谢,
Tom

解决方案

修复链接

[ ^ ]
WCF BasicHttpBinding和IIS 6.0上的Windows身份验证 [<?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> <authentication mode="Windows"/> </system.web> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="false"/> <!-- 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> <bindings> <basicHttpBinding> <binding name="AppHttpBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" /> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows"/> </security> </binding> </basicHttpBinding> </bindings> <services> <service name="Volpe.Services.SAS.Internal.Host.SecurityService"> <endpoint name="AppHttpEndpoint" address="" binding="basicHttpBinding" bindingConfiguration="AppHttpBinding" contract="Volpe.Services.SAS.Internal.Contracts.Security.ISecurityService" /> </service> <service name="Volpe.Services.SAS.Internal.Host.NotificationService"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="AppHttpBinding" contract="Volpe.Services.SAS.Internal.Contracts.Notifications.INotificationService"/> </service> </services> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration>


I of course Googled this error multiple times, and saw various technical articles addressing how to get rid of the error. Most attributed it to having a MEX endpoint defined. As you can see in the web.config above, there is no such endpoint defined. It seems like there’s something specific in our solution framework that is causing the WCF runtime to think that it requires Anonymous access to the site. I tried debugging it by trying a multitude of potential solutions. I even downloaded the .NET framework code and stepped through it, but I still get the error.

Any help would be greatly appreciated.

Thanks,
Tom

解决方案

Fix links

WCF Exception: Security settings for this service require ''Anonymous'' Authentication but it is not enabled for the IIS application that hosts this service[^]
WCF BasicHttpBinding and windows authentication on IIS 6.0[^]


这篇关于安全设置需要匿名身份验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆