4

在我的项目中,我使用的是 ACS SAML 安全性。这里我们需要提供客户端证书和服务器私钥来调用服务,这些可以在 webconfig 文件中设置。在 Azure 中运行的 Web 服务很好,但我需要在我们的远程服务器中运行 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

所以请帮助我..如何解决这个问题?

4

0 回答 0