C# WCF:未提供服务证书。在ServiceCredentials中指定服务证书

C# WCF:未提供服务证书。在ServiceCredentials中指定服务证书,c#,.net,wcf,.net-4.0,C#,.net,Wcf,.net 4.0,我正在尝试创建一个WCF服务,它使用MembershipProvider进行身份验证。因为它是一种内部服务,所以我目前对应用传输级安全性(HTTPS)不感兴趣,我希望(目前)在没有证书的情况下这样做。此外,这将使推出这项服务变得复杂,我希望以后再这样做。我已经构建了一个基本配置(即使没有配置成员资格提供程序),但WCF一直向我抛出以下异常: 未提供服务证书。请指定服务证书 在ServiceCredentials中 以下是我的配置: <serviceBehaviors> <

我正在尝试创建一个WCF服务,它使用
MembershipProvider
进行身份验证。因为它是一种内部服务,所以我目前对应用传输级安全性(HTTPS)不感兴趣,我希望(目前)在没有证书的情况下这样做。此外,这将使推出这项服务变得复杂,我希望以后再这样做。我已经构建了一个基本配置(即使没有配置
成员资格提供程序
),但WCF一直向我抛出以下异常:

未提供服务证书。请指定服务证书 在ServiceCredentials中

以下是我的配置:

<serviceBehaviors>
    <behavior name="">
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
        <serviceDebug includeExceptionDetailInFaults="false" />

        *<serviceCredentials>
            <serviceCertificate findValue="certificatename" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
        </serviceCredentials>*
     </behavior>
</serviceBehaviors>

异常的堆栈跟踪:

[无效操作例外:未提供服务证书。 在ServiceCredentials中指定服务证书。]
System.ServiceModel.Security.ServiceCredentialSecurityTokenManager.CreateServerX509TokenProvider() +12382737 System.ServiceModel.Security.ServiceCredentialsSecurityTokenManager.CreateLocalSecurityTokenProvider(RecipientServiceModelSecurityTokenRequirement 接收方要求)+63
System.ServiceModel.Security.ServiceCredentialSecurityTokenManager.CreateSecurityTokenProvider(SecurityTokenRequirement 要求)+48
System.ServiceModel.Security.ServiceCredentialsSecurityTokenManager.CreateTlsnegoServerX509TokenProvider(RecipientServiceModelSecurityTokenRequirement 接收方要求)+191
System.ServiceModel.Security.ServiceCredentialsSecurityTokenManager.CreateTlsnegoSecurityTokenAuthenticator(RecipientServiceModelSecurityTokenRequirement recipientRequirement,布尔RequiremeClientCertificate, SecurityTokenResolver和sctResolver)+683
System.ServiceModel.Security.ServiceCredentialsSecurityTokenManager.CreateSecurityTokenAuthenticator(SecurityTokenRequirement tokenRequirement、SecurityTokenResolver和outOfBandTokenResolver) +12383208 System.ServiceModel.Security.SessionRenewSecurityTokenManager.CreateSecurityTokenAuthenticator(SecurityTokenRequirement 令牌要求,安全令牌解析程序和outOfBandTokenResolver)+81
System.ServiceModel.Security.SymmetricSecurityProtocolFactory.OnOpen(TimeSpan 超时)+181
System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan 超时)+21
System.ServiceModel.Channel.CommunicationObject.Open(时间跨度 超时)+318
System.ServiceModel.Security.SecurityListenerSettingsLifetimeManager.Open(TimeSpan 超时)+94
System.ServiceModel.Channel.SecurityChannelListener`1.OnOpen(TimeSpan 超时)+240
System.ServiceModel.Channel.CommunicationObject.Open(时间跨度 超时)+318
System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan 超时)+72

[InvalidOperationException:位于 'http://localhost:9800/Service1.svc‘有合约’ “'IssueAndRenewSession'”无法打开其IChannelListener。]
System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan 超时)+118
System.ServiceModel.Channel.CommunicationObject.Open(时间跨度 超时)+318 System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan 超时)+111
System.ServiceModel.Channel.CommunicationObject.Open(时间跨度 超时)+318
System.ServiceModel.Security.SecuritySessionSecurityTokenAuthenticator.OnOpen(TimeSpan 超时)+131
System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan 超时)+21
System.ServiceModel.Channel.CommunicationObject.Open(时间跨度 超时)+318
System.ServiceModel.Security.CommunicationObjectSecurityTokenAuthenticator.Open(TimeSpan 超时)+20
System.ServiceModel.Security.SecuritySessionServerSettings.OnOpen(TimeSpan 超时)+792
System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan 超时)+21
System.ServiceModel.Channel.CommunicationObject.Open(时间跨度 超时)+318
System.ServiceModel.Security.SecurityListenerSettingsLifetimeManager.Open(TimeSpan 超时)+148
System.ServiceModel.Channel.SecurityChannelListener`1.OnOpen(TimeSpan 超时)+240
System.ServiceModel.Channel.CommunicationObject.Open(时间跨度 超时)+318
System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan 超时)+72

[InvalidOperationException:位于 'http://localhost:9800/Service1.svc“具有合同的”“IService1”“是 无法打开其IChannelListener。]
System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan 超时)+118
System.ServiceModel.Channel.CommunicationObject.Open(时间跨度 超时)+318 System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan 超时)+111
System.ServiceModel.Channel.CommunicationObject.Open(时间跨度 超时)+318
System.ServiceModel.HostingManager.ActivateService(字符串 标准化虚拟路径)+206
System.ServiceModel.HostingManager.EnsureServiceAvailable(字符串 标准化虚拟路径)+651

[ServiceActivationException:服务'/Service1.svc'不能为空 由于编译期间出现异常而激活。异常 消息是:ChannelDispatcher在 'http://localhost:9800/Service1.svc“具有合同的”“IService1”“是 无法打开其IChannelListener..]
System.Runtime.AsyncResult.End(IAsyncResult结果)+688590
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult 结果)+190
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication 上下文,字符串routeServiceVirtualPath,布尔流上下文,布尔 确保服务)+234