I created a web service with Visual Studio 2015 .Net Framework 4.5. It uses RestSharp to call a REST service on an external system with a certificate. If I run it as an application on one of our servers (Windows Server 2012R2, IIS 8.5.9600.16384) it works
perfectly. Running it on our target production server which is the same version of Windows, but IIS 8.0.9200.16384) the app crashes.
Certificates are installed on both machines on the Local Machine store and are properly read by the app. Both are running 4.5 application pools (the server where it works it says it is CLR 4.0.30319 and the one where it doesn't it says .NET Framework 4.0.30319.
Both application pools are configured for both local and domain administrator access.
I have attached the output from the event log.
Any ideas?
+ System - Provider [ Name] .NET Runtime - EventID 1026 [ Qualifiers] 0 Level 2 Task 0 Keywords 0x80000000000000 - TimeCreated [ SystemTime] 2016-09-13T16:22:18.000000000Z EventRecordID 2659218 Channel Application Computer XXXXXXXXXXXXXXXXXXX Security - EventData Application: w3wp.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.AccessViolationException Stack: at System.Net.UnsafeNclNativeMethods+SafeNetHandles_SECURITY.AcquireCredentialsHandleW(System.String, System.String, Int32, Void*, System.Net.SecureCredential ByRef, Void*, Void*, System.Net.SSPIHandle ByRef, Int64 ByRef) at System.Net.UnsafeNclNativeMethods+SafeNetHandles_SECURITY.AcquireCredentialsHandleW(System.String, System.String, Int32, Void*, System.Net.SecureCredential ByRef, Void*, Void*, System.Net.SSPIHandle ByRef, Int64 ByRef) at System.Net.SafeFreeCredentials.AcquireCredentialsHandle(System.Net.SecurDll, System.String, System.Net.CredentialUse, System.Net.SecureCredential ByRef, System.Net.SafeFreeCredentials ByRef) at System.Net.SSPIWrapper.AcquireCredentialsHandle(System.Net.SSPIInterface, System.String, System.Net.CredentialUse, System.Net.SecureCredential) at System.Net.Security.SecureChannel.AcquireCredentialsHandle(System.Net.CredentialUse, System.Net.SecureCredential ByRef) at System.Net.Security.SecureChannel.AcquireClientCredentials(Byte[] ByRef) at System.Net.Security.SecureChannel.GenerateToken(Byte[], Int32, Int32, Byte[] ByRef) at System.Net.Security.SslState.StartSendBlob(Byte[], Int32, System.Net.AsyncProtocolRequest) at System.Net.Security.SslState.ProcessReceivedBlob(Byte[], Int32, System.Net.AsyncProtocolRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte[], System.Net.AsyncProtocolRequest) at System.Net.Security.SslState.StartSendBlob (Byte[], Int32, System.Net.AsyncProtocolRequest) at System.Net.Security.SslState.ForceAuthentication(Boolean, Byte[], System.Net.AsyncProtocolRequest) at System.Net.Security.SslState.ProcessAuthentication(System.Net.LazyAsyncResult) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Net.TlsStream.ProcessAuthentication(System.Net.LazyAsyncResult) at System.Net.TlsStream.Write(Byte[], Int32, Int32) at System.Net.ConnectStream.WriteHeaders (Boolean) at System.Net.HttpWebRequest.EndSubmitRequest() at System.Net.Connection.CompleteConnection(Boolean, System.Net.HttpWebRequest) at System.Net.Connection.CompleteStartConnection(Boolean, System.Net.HttpWebRequest) at System.Net.Connection.CompleteStartRequest(Boolean, System.Net.HttpWebRequest, System.Net.TriState) at System.Net.Connection.SubmitRequest(System.Net.HttpWebRequest, Boolean) at System.Net.ServicePoint.SubmitRequest(System.Net.HttpWebRequest, System.String) at System.Net.HttpWebRequest.SubmitRequest(System.Net.ServicePoint) at System.Net.HttpWebRequest.GetRequestStream(System.Net.TransportContext ByRef) at System.Net.HttpWebRequest.GetRequestStream() at RestSharp.Http.WriteRequestBody(System.Net.HttpWebRequest) at RestSharp.Http.PostPutInternal(System.String) at RestSharp.RestClient.Execute(RestSharp.IRestRequest, System.String, System.Func`3<RestSharp.IHttp,System.String,RestSharp.HttpResponse>) at RestSharp.RestClient.Execute