【发布时间】:2012-11-19 14:25:01
【问题描述】:
我们在 http://www.domain.com/service.svc 上运行了 WCF-REST 服务。一家外部公司正在调用此 Web 服务,由于可以传输敏感数据,我们希望该服务在 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 中。然后,调用我们的网络服务的公司应该在他们的代码中输入这些凭据,以便能够调用我们的服务。我们如何配置它?
【问题讨论】:
标签: vb.net wcf web-services basic-authentication