【发布时间】:2012-03-16 21:04:34
【问题描述】:
我正在创建一个需要代理用户名和密码的 WCF 服务,为此我需要提供一个服务证书,我已为其提供了我们公司的有效 Verisign 证书。
我遇到的问题是,每当我使用以下配置时,我都会收到一条错误消息“未提供服务证书。在 ServiceCredentials 中指定服务证书。”
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false" />
<behaviors>
<serviceBehaviors>
<behavior name="WSBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<serviceCertificate findValue="devstage1.vcg-online.net" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="TrustedPublisher" />
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Acre.IntegrationService.CustomValidator, Acre.IntegrationService" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Acre.IntegrationService.IntegrationService" behaviorConfiguration="WSBehaviour">
<endpoint address="http://localhost/Acre.IntegrationService/IntegrationService.svc"
binding="wsHttpBinding"
bindingConfiguration="WSBinding"
contract="Acre.IntegrationService.IIntegrationService"
name="WS" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="WSBinding" allowCookies="false">
<security mode="Message">
<message clientCredentialType="UserName" negotiateServiceCredential="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
更新配置
我已在控制台中使用 mmc.exe 将证书安装到以下路径
证书(本地计算机)/个人/证书/ 证书(本地计算机)/受信任的根证书颁发机构/证书/ 证书(本地计算机)/受信任的发布者/证书/
我已经搜索了互联网,但找不到明确的解决方案。 有人可以帮忙吗?
【问题讨论】:
-
注意:证书也安装在当前用户和计算机下的那些位置。并已导入IIS
-
你应该指定一个需要使用的serviceCertificate。您是否尝试通过传输通道使用 SSL 保护服务?
-
我在服务行为中指定一个证书,是的 SSL over transport 用于自定义授权...忽略这一点,我刚刚注意到我正在使用客户端证书,我将更改它并尝试它
-
我将配置更改为有一个 serviceCertificate,现在错误是 KeySet 不存在
-
它是自签名证书吗?另外请更新您的配置
标签: wcf wcf-security x509certificate