使用iisexpress传输安全和基本身份验证的WCF服务身份验证始终返回401

使用iisexpress传输安全和基本身份验证的WCF服务身份验证始终返回401,wcf,visual-studio-2010,ssl,httpmodule,iis-express,Wcf,Visual Studio 2010,Ssl,Httpmodule,Iis Express,我将WCF服务配置为使用传输安全性和基本身份验证 该服务通过vs2010托管在iiexpress中 我可以通过客户端代码进行连接,但始终会收到: "The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic realm=realm'." 这有一个内在的例外: "The re

我将WCF服务配置为使用传输安全性和基本身份验证

该服务通过vs2010托管在iiexpress中

我可以通过客户端代码进行连接,但始终会收到:

"The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic realm=realm'."
这有一个内在的例外:

"The remote server returned an error: (401) Unauthorized."
与类似,尽管我的客户机代码已经具有答案中列出的设置

我还按照和前面的博客设置了一个模块和IAuthorizationPolicy类

IISExpress在经典模式下配置,禁用匿名和windows身份验证,并启用SSL

客户端配置:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="NotificationHttpBinding">
          <security mode="Transport">
            <transport clientCredentialType="Basic" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://localhost/NotificationService.svc"
         binding="basicHttpBinding" bindingConfiguration="NotificationHttpBinding"
         contract="NotificationPortType" name="BasicHttpBinding_NotificationPortType" />
    </client>
  </system.serviceModel>
或者 如果有人能告诉我如何使用IIS6托管一个WCF服务,它使用基本http身份验证,同时需要SSL(https),我会很高兴的


更新 似乎这一直都是我的罪魁祸首:

然而,我发现我的模块启动良好(在集成模式下),但随后出现了一个服务错误,告诉我需要基本集成,但主机上没有启用

打开iisexpress applicationhost.config文件,果然发现:

<section name="basicAuthentication" overrideModeDefault="Deny" />

<basicAuthentication enabled="false" />

再往下

我已将这些更改为


并尝试在我的web.config中启用…无骰子:(

您需要使用
WSHttpBinding


有一个完整的示例。

不是直接的答案,但MS现在发布了一个专门用于开发工作站的IIS7。这个版本比VS附带的小型服务器工作得好得多,从某种意义上说,它更接近应用程序最终将要运行的服务器。也许如果您设置它,它将更容易根据需要进行配置。是的,IISExpress 7.5具有VS2010 SP1集成功能。我已经在使用它。请注意您提供的链接(共3部分)传输凭据设置为
None
,这说明WCF没有进行身份验证,但IIS httpmodule正在进行身份验证。您能试试看吗?是的,不幸的是,这也返回了相同的错误。我只是不确定iisexpress是否以代码最初预期的方式运行。事实上,我不确定此代码是否有效看到了吗?不幸的是,我要求非WCF平台能够使用SOAP1.1访问,所以basicHttpBinding就是这样。
<section name="basicAuthentication" overrideModeDefault="Deny" />
<basicAuthentication enabled="false" />