【发布时间】:2010-08-18 11:18:30
【问题描述】:
大家好,
我正在互联网场景中编写服务。我必须实现消息加密。我得到了一切,但是当我从 IIS 浏览此服务时,出现以下异常。
“/MyTestService”中的服务器错误 申请。
键集不存在
描述:未处理的异常 在执行过程中发生 当前的网络请求。请查看 堆栈跟踪以获取有关的更多信息 错误及其起源 代码。
异常详情: System.Security.Cryptography.CryptographicException: 键集不 存在................................................. .....
.................................................. .....................
这似乎是证书问题。有人可以解释如何处理证书的东西,请详细说明。只是认为我是证书的新手。
<system.serviceModel>
<services>
<service name="Test.MyService" behaviorConfiguration="MyServiceBehavior">
<!-- Service Endpoints -->
<endpoint address="MyTestService" binding="wsHttpBinding" bindingConfiguration="WebserviceHttpBinding" contract="Test.IMyService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="WebserviceHttpBinding">
<security mode="Message">
<message clientCredentialType="UserName" negotiateServiceCredential="false"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Test.CredentialValidator, Test"/>
<serviceCertificate findValue="RPKey" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
</serviceCredentials>
<!-- 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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
【问题讨论】:
标签: wcf wcf-security