我有一个使用基本HTTP身份验证模式的WebHttpBinding服务,但是由于某些奇怪的原因,它验证了对Windows帐户提供的用户名/密码,我认为我指定了userNamePasswordValidationMode =“MembershipProvider”。
我发现其他帖子也报告了这个问题,但没有回答这种情况。
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="WebBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" />
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="EPWeb">
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="SqlProvider" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ServiceBehavior" name="Foo">
<endpoint address="Test" behaviorConfiguration="EPWeb"
binding="webHttpBinding" bindingConfiguration="WebBinding"
contract="Foo.IService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:3456/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
答案 0 :(得分:0)
此配置无效。但是这个问题有变通方法:
答案 1 :(得分:0)
Token通过登录或自定义http身份验证模块。
以下是自定义身份验证模块的链接。 http://custombasicauth.codeplex.com/
对于基于令牌的,您可以使用OAuth实现。