【发布时间】:2011-10-09 21:46:03
【问题描述】:
有没有办法从 webHttpBinding WCF 服务中的原始浏览器传递域凭据? 我认为这应该是可能的,因为当我登录到任何在 IIS 中启用 Windows 身份验证的 aspx 页面时,我可以获得调用用户的域凭据。我将如何以这种方式设置我的 WCF 服务?目前我在 WCF 服务中获得的用户身份是运行 svc 的应用程序池的用户身份吗?
编辑
我没有 .NET 4 -- 我的配置文件在下面,但我仍然收到错误:
此服务的安全设置需要“匿名”身份验证 但托管此服务的 IIS 应用程序未启用它。
我应该在 IIS 中为该路径显式启用匿名吗?我认为这会使我获得域名的努力付诸东流。
<behaviors>
<endpointBehaviors>
<behavior name="Awesome.Project.OperationsBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</serviceBehaviors>
<behavior name="Awesome.Project.OperationsServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="Awesome.Project.OperationsServiceBehavior"
name="Awesome.Project.Operations">
<endpoint address="" binding="webHttpBinding"
contract="Awesome.Project.Operations"
behaviorConfiguration="Awesome.Project.OperationsBehavior"
bindingName="windowsSecurityWebHttpBinding">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!--<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />-->
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="windowsSecurityWebHttpBinding">
<security mode="Transport">
<transport clientCredentialType="Windows"/>
</security>
</binding>
</webHttpBinding>
</bindings>
【问题讨论】:
-
谁在调用服务 - 浏览器还是 aspx 页面?
-
它来自浏览器。
-
在您的端点中将 bindingName 更改为 bindingConfiguration
-
更新了我的答案以显示 3.5 版本
标签: asp.net wcf dns wcf-security wcf-client