我正在尝试使用 WCF 开发服务,但找不到我创建的证书,该证书位于 TrustedPeple 文件夹下。到目前为止,这是我编写的代码块:
client.ClientCredentials.ServiceCertificate.SetDefaultCertificate(
StoreLocation.CurrentUser,
StoreName.My,
X509FindType.FindBySubjectName,
"WCfClient");
从上面的代码可以看出,我也尝试过手动设置证书特征,但还是找不到。
此外,我将发布我的 conif xml 文件的一部分以便更好地理解:
<services>
<service
name="XMLServices.CriDecServices.CriDecService"
behaviorConfiguration="wsHttpCertificateBehavior">
<endpoint name="CriDecPoint"
address=""
binding="wsHttpBinding"
bindingConfiguration="wsHttpEndpointBinding"
contract="XMLContracts.ServiceContracts.ICriDecService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/XMLServices/CriDecServices/CriDecService" />
</baseAddresses>
</host>
</service>
<service
name="XMLServices.UtenteServices.UtenteService"
behaviorConfiguration="wsHttpCertificateBehavior">
<endpoint
name="UserPoint"
address=""
binding="wsHttpBinding"
bindingConfiguration="wsHttpEndpointBinding"
contract="XMLContracts.ServiceContracts.IUtenteService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8766/XMLServices/UtenteServices/UtenteService" />
</baseAddresses>
</host>
</service>
</services>
这是我得到的例外:
“未提供客户端证书。在 ClientCredentials 中指定客户端证书。”
谁能帮我理解为什么我似乎找不到我的证书?谢谢