In my project I use ACS SAML Security. Here we need to provide a client certificate and a server private key to call the service, they can be installed in the webconfig file. The web service running on Azure is great, but I need to run the web service on our remote server. So I published the project in IIS. But I get an exception.
An internal error has occurred.
Description: An unhandled exception occurred during the execution of the current web request. View the stack trace for more information about the error and its occurrence in the code.
Exception Details: System.Security.Cryptography.CryptographicException: An internal error occurred.
Source Error:
An unhandled exception was thrown during the execution of the current web request. Information about the origin and location of the exception can be identified using the trace of the exception stack below.
Stack trace:
[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
So please help me .. how to solve the problem?
source share