简体   繁体   English

使用成员资格提供程序保护WCF,但收到证书错误

[英]WCF Secured Using Membership Provider, but getting certificate error

I've created a custom membership provider and I am trying to use it to secure my WCF service. 我已经创建了一个自定义成员资格提供程序,并且试图使用它来保护我的WCF服务。 But, I am getting this error: 但是,我收到此错误:

The service certificate is not provided. Specify a service certificate in ServiceCredentials.

I don't want to use an x509 certificate. 我不想使用x509证书。 How can I get this working? 我该如何工作?

Here is my service config: 这是我的服务配置:

<?xml version="1.0"?>

<bindings>
  <wsHttpBinding>
    <binding name="wsHttpBinding1" maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="Message">
        <message clientCredentialType="UserName"/>
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<services>
  <service name="UpdateService.UpdateService" behaviorConfiguration="ASPNETProviders">
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding1"
      contract="UpdateService.IUpdateService" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ASPNETProviders">
      <serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="myUpdateMembershipProvider"/>            
      </serviceCredentials>
    </behavior>
    <behavior>          
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
  multipleSiteBindingsEnabled="true" />

UPDATE 更新

This blog post, enter link description here , says: 这篇博客文章, 在这里输入链接描述 ,说:

[When] you opt in for the UserName client credential type, WCF insists that your service must also reference a service certificate that contains a private key.

I am going to host my service in IIS and plan to use SSL certificate in the web site for encrypting communication. 我将在IIS中托管我的服务,并计划在网站中使用SSL证书来加密通信。 Can I make WCF not insist that I reference a service certificate? 我可以使WCF不坚持引用服务证书吗?

It seems that Microsoft really, really wants me to use a certificate. 看来Microsoft确实非常希望我使用证书。

Someone developed a Clear Username Binding for my situation, but I think I may just surrender and use a certificate. 有人针对我的情况开发了“ 清除用户名绑定 ”,但我认为我可能只是投降并使用证书。

Have you try to create a custom credential validator ? 您是否尝试创建自定义凭据验证器? See this : http://nayyeri.net/custom-username-and-password-authentication-in-wcf-3-5 看到这个: http : //nayyeri.net/custom-username-and-password-authentication-in-wcf-3-5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM