“System.Security.Cryptography.CryptographicException:发生内部错误”?

时间:2012-11-06 11:32:11

标签: c# saml acs x509certificate2

在我的项目中,我正在使用ACS SAML安全性。这里我们需要提供客户端证书和服务器私钥来调用服务,这些可以在webconfig文件中设置。 Web服务在Azure中运行很好,但我需要在远程服务器中运行Web服务。所以我在IIS中发布了这个项目。但我得到例外......

  

发生内部错误。

     

描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

     

异常详细信息:System.Security.Cryptography.CryptographicException:发生内部错误。

     

来源错误:

     

在执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息。

     

堆栈追踪:

[CryptographicException: An internal error occurred.]
   System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) +41
   System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromFile(String fileName, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx) +0
   System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags) +372
   System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password) +157
   ClassicMDM.WCFServiceWebRole.MyServiceHostfactory.GetServiceCertificateWithPrivateKey() in F:\Core\_Core\Class\trunk\test.WCFServiceWebRole\testWebService.svc.cs:172
   test.WCFServiceWebRole.MyServiceHostfactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) in F:\Core\_Core\Class\trunk\test.WCFServiceWebRole\testWebService.svc.cs:140
   System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +530
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1413
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +50
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +1172

[ServiceActivationException: The service '/testwebserviceINT/testWebService.svc' cannot be activated due to an exception during compilation.  The exception message is: An internal error occurred]
   System.Runtime.AsyncResult.End(IAsyncResult result) +901424
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +178702
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +136

所以请帮帮我......怎样才能解决问题?

0 个答案:

没有答案