我正在寫服務的互聯網場景。我必須實現消息加密。我得到了一切,但當我從IIS瀏覽這個服務時,我得到以下異常。
'/ MyTestService'中的服務器錯誤 應用程序。
鍵集不存在
說明:未處理的異常 的 當前Web請求的執行過程中發生。請查看 堆棧跟蹤以瞭解有關 錯誤的更多信息,以及它源自 的代碼。
異常詳細信息: 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>
有沒有任何鏈接,我可以在哪裏閱讀有關公共和私人證書或視頻教程? – Saghar 2010-08-18 11:41:51
條款私人和公共證書可能不正確。證書是密鑰和相關信息的標準化容器(如發行人,到期日,主題,序列號等)。存儲在服務器上的證書必須包含私鑰和公鑰。提供給客戶的證書只能包含公鑰 - 公鑰基礎設施。 – 2010-08-18 19:54:38
您的解決方案爲我工作 - 比你。 – Vlad 2012-09-24 11:11:15