我们已经在http://www.domain.com/service.svc上运行了一个WCF-REST服务。外部公司正在调用此we服务,由于可以传输敏感数据,因此我们希望该服务在SSL下运行并使用基本身份验证。
我们已经运行了SSL,但基本身份验证出现了问题。web.config看起来像这样;
<behaviors>
<endpointBehaviors>
<behavior name="REST">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<webHttpBinding>
<binding name="webBindingMobile">
<security mode="Transport">
<transport clientCredentialType="Basic" />
</security>
</binding>
</webHttpBinding>
<services>
<service name="Website.Mobile.Webservice">
<endpoint address="" behaviorConfiguration="REST" binding="webHttpBinding" contract="Website.PaymentProxy.Services.Proxy.IProxyClientInterface" bindingConfiguration="webBindingMobile" />
</service>
<service name="Website.Mobile.ShoppingCartService">
<endpoint address="" behaviorConfiguration="REST" binding="webHttpBinding" contract="Website.PaymentProxy.Services.Proxy.Cart.Interfaces.IShoppingCartService" bindingConfiguration="webBindingMobile" />
</service>
</services>我们需要的只是一个简单的用户名和密码(最好是)存储在web.config中。调用我们的then服务的公司应该在他们的代码中输入这些凭据,以便能够调用我们的服务。我们如何配置它呢?
发布于 2012-11-27 17:33:54
这可能会对你有所帮助。
https://github.com/mikeobrien/WcfRestContrib/wiki
我相信您也经历过这个过程,您可能会对基于角色的身份验证http://msdn.microsoft.com/en-us/library/ff647503.aspx感兴趣
https://stackoverflow.com/questions/13455787
复制相似问题