【问题标题】:asp.net Webservice with basis authentication, how to configure username and password具有基本身份验证的asp.net Web服务,如何配置用户名和密码
【发布时间】: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


    【解决方案1】:

    也许这对你有点帮助

    https://github.com/mikeobrien/WcfRestContrib/wiki

    我相信你也经历过这个,你可能对基于角色的身份验证感兴趣 http://msdn.microsoft.com/en-us/library/ff647503.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      • 2016-09-14
      • 1970-01-01
      • 2011-03-18
      • 2013-06-11
      • 2015-07-27
      • 2016-04-19
      相关资源
      最近更新 更多