【发布时间】:2012-11-20 18:59:06
【问题描述】:
我在 ASP.net 项目中有一个带有(常规)WCF 服务的 Silverlight 5 Prism 应用程序。我正在使用 IIS 7.5 在本地主机上托管它。我遵循了
中的所有步骤How to: Use Windows Authentication to Secure a Service for Silverlight Applications
How to: Host a Secure Service in ASP.NET for Silverlight Applications
但我无法让 Windows 身份验证工作。每当我在 IIS 中关闭匿名身份验证时,我的应用程序都会抛出 The remote server returned an error: NotFound. 异常,因为它找不到 WCF 服务。
当我尝试在 Visual Studio 中更新服务引用时,我收到错误 Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.
当我打开匿名身份验证时,服务可以工作,但我没有获得 Windows 用户凭据。我的浏览器(IE 8)设置为使用集成 Windows 身份验证并自动登录本地 Intranet。
我做错了什么?
这是我的 IIS 7.5 配置。应用程序池正在集成模式下运行:
web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation debug="true" />
<authentication mode="Windows" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
</configuration>
ServiceReferences.ClientConfig:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ISecurityService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="TransportCredentialOnly" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:85/SecurityService/SecurityService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISecurityService"
contract="SecurityServiceReference.ISecurityService" name="BasicHttpBinding_ISecurityService" />
</client>
</system.serviceModel>
</configuration>
【问题讨论】:
标签: wcf silverlight authentication iis