J
jNorton
I have two servers in a web farm that are (as far as I can tell) configured
exactly the same. One server works fine when runnin the following code, the
other throws an exception. The code and execption are:
HttpWebRequest request;
request =
(HttpWebRequest)WebRequest.Create(@"https://wwwcie.ups.com/ups.app/xml/Track");
HttpWebResponse response;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = authXml.Length + requestXml.Length;
StreamWriter requestString = new StreamWriter(request.GetRequestStream());
requestString.Write(authXml + requestXml);
requestString.Close();
request.Timeout = 15000;
response = (HttpWebResponse)request.GetResponse();
using (StreamReader sr = new StreamReader(response.GetResponseStream()))
{
return sr.ReadToEnd();
}
EXCEPTION:
System.Net.WebException: The underlying connection was closed: Could not
establish secure channel for SSL/TLS. --->
System.TypeInitializationException: The type initializer for
"System.Net.SecureChannel" threw an exception. --->
System.EntryPointNotFoundException: Unable to find an entry point named
EnumerateSecurityPackagesW in DLL security.dll. at
System.Net.NativeNTSSPI.EnumerateSecurityPackagesW(Int32& pkgnum, IntPtr&
arrayptr) at
System.Net.SSPISecureChannelType.EnumerateSecurityPackages(Int32& pkgnum,
IntPtr& arrayptr) at
System.Net.SSPIWrapper.EnumerateSecurityPackages(SSPIInterface SecModule) at
System.Net.SSPIWrapper.GetSupportedSecurityPackages(SSPIInterface SecModule)
at System.Net.SecureChannel..cctor() --- End of inner exception stack trace
--- at System.Net.SecureChannel..ctor(String hostname,
X509CertificateCollection clientCertificates) at
System.Net.TlsStream.Handshake(ProtocolToken message) --- End of inner
exception stack trace --- at System.Net.HttpWebRequest.CheckFinalStatus() at
System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult) at
System.Net.HttpWebRequest.GetRequestStream() at
NSP.Utilities.UPS.processUPSRequest(String requestXml, UPSRequestType type)
Any ideas?
exactly the same. One server works fine when runnin the following code, the
other throws an exception. The code and execption are:
HttpWebRequest request;
request =
(HttpWebRequest)WebRequest.Create(@"https://wwwcie.ups.com/ups.app/xml/Track");
HttpWebResponse response;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = authXml.Length + requestXml.Length;
StreamWriter requestString = new StreamWriter(request.GetRequestStream());
requestString.Write(authXml + requestXml);
requestString.Close();
request.Timeout = 15000;
response = (HttpWebResponse)request.GetResponse();
using (StreamReader sr = new StreamReader(response.GetResponseStream()))
{
return sr.ReadToEnd();
}
EXCEPTION:
System.Net.WebException: The underlying connection was closed: Could not
establish secure channel for SSL/TLS. --->
System.TypeInitializationException: The type initializer for
"System.Net.SecureChannel" threw an exception. --->
System.EntryPointNotFoundException: Unable to find an entry point named
EnumerateSecurityPackagesW in DLL security.dll. at
System.Net.NativeNTSSPI.EnumerateSecurityPackagesW(Int32& pkgnum, IntPtr&
arrayptr) at
System.Net.SSPISecureChannelType.EnumerateSecurityPackages(Int32& pkgnum,
IntPtr& arrayptr) at
System.Net.SSPIWrapper.EnumerateSecurityPackages(SSPIInterface SecModule) at
System.Net.SSPIWrapper.GetSupportedSecurityPackages(SSPIInterface SecModule)
at System.Net.SecureChannel..cctor() --- End of inner exception stack trace
--- at System.Net.SecureChannel..ctor(String hostname,
X509CertificateCollection clientCertificates) at
System.Net.TlsStream.Handshake(ProtocolToken message) --- End of inner
exception stack trace --- at System.Net.HttpWebRequest.CheckFinalStatus() at
System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult) at
System.Net.HttpWebRequest.GetRequestStream() at
NSP.Utilities.UPS.processUPSRequest(String requestXml, UPSRequestType type)
Any ideas?