【发布时间】:2013-03-04 21:41:10
【问题描述】:
我有一个使用表单身份验证的 MVC 应用程序。此应用程序还托管 WCF Web 服务(模型)。 Webservice 为应用程序提供 c# 对象,当从应用程序(浏览器)外部调用时,相同的数据可用作 JSON。 除了 Web 服务没有对任何请求进行身份验证之外,一切都运行良好。以下是我在 web.config 中的内容:
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<behaviors>
<endpointBehaviors>
<behavior name="ServiceBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webHttpBindingWithJson" crossDomainScriptAccessEnabled="true" />
</webHttpBinding>
</bindings>
<services>
<service name="Services.MyService">
<endpoint address="http://localhost:1234/MyService.svc/" binding="webHttpBinding"
bindingConfiguration="webHttpBindingWithJson"
contract="Services.IService"
behaviorConfiguration="ServiceBehavior"/>
</service>
</services>
我想验证 Web 服务请求:
- 应自动验证来自应用程序内部的请求
- 从应用程序外部调用 Web 服务时,会要求用户进行身份验证。
任何帮助将不胜感激。
/D
【问题讨论】:
标签: wcf model-view-controller authentication wcf-security