The underlying connection was closed: Could not establish secure channel for SSL/TLS.

J

Jim Butler

I have this error that is happening on all of our web servers (production
included). It basically started occurring once we loaded 2005 sql client
tools, asp.net 2.0 (and all related prerequistes) on our windows 2003 web
servers (unfortunately they are needed, so uninstalling is not an option).
The web app where this happens, runs both asp code and .net 1.1 code within
the same web app. In the asp app, we scrape and post data to .net 1.1 pages
in the middle of asp pages. This is accomplished through a com visible .net
class (in GAC too, code below). The errors didn't start happening till we
installed the above software and now the entire app is unstable and the
errors are sproadic. Typically, once the error has happened, the entire app
must be recycled. The web app is running in local system, and it isolated
by itself (no other web apps share the pool) In iis, the app is set to run
under the 1.1 framework. My recent hopeful fix was to set keep-alives to
false and switch the protocol to v10 (based on other research), which didn't
really help. The error presents itself equally across post's and get's.

Any ideas, it is creating a huge problem for us,

TIA

jim butler


Option Explicit On
Option Strict On

Imports System.Net
Imports System.IO
Imports Microsoft.VisualBasic
Imports System.Runtime.InteropServices
Imports System.Web

Public Class HttpAutomation
Public Sub New()
' do nothing, needed for com
End Sub
<ComVisible(True)> Public Function GetPage(ByVal url As String) As
String
Dim result As String
Dim objResponse As HttpWebResponse
Dim objRequest As HttpWebRequest =
CType(System.Net.HttpWebRequest.Create(url), HttpWebRequest)
objRequest.KeepAlive = False
objRequest.ProtocolVersion = HttpVersion.Version10
objRequest.Accept = "*/*"
objRequest.UserAgent = "User-Agent, Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705"
objResponse = CType(objRequest.GetResponse(), HttpWebResponse)
Dim sr As New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()
' Close and clean up the StreamReader
sr.Close()
objResponse.Close()
Return result
End Function

<ComVisible(True)> Public Function PostPage(ByVal url As String, ByVal
formVariables As String) As String
Dim result As String
Dim myWriter As StreamWriter = Nothing
Dim objResponse As HttpWebResponse
Dim objRequest As HttpWebRequest =
CType(System.Net.HttpWebRequest.Create(url), HttpWebRequest)
objRequest.Method = "POST"
objRequest.ContentLength = formVariables.Length
objRequest.ContentType = "application/x-www-form-urlencoded"
objRequest.KeepAlive = False
objRequest.ProtocolVersion = HttpVersion.Version10
objRequest.Accept = "*/*"
objRequest.UserAgent = "User-Agent, Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705"

Try
myWriter = New StreamWriter(objRequest.GetRequestStream())
myWriter.Write(formVariables)
Catch e As Exception
Throw New Exception("Error in HTTPAutomation: URL: " & url & "
:FormVariables: " & formVariables)
Finally
myWriter.Close()
End Try

objResponse = CType(objRequest.GetResponse(), HttpWebResponse)
Dim sr As StreamReader
sr = New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()
sr.Close()

Return result

End Function
End Class
 
S

Steven Cheng[MSFT]

Hi Jim,

Welcome to the ASP.NET newsgroup.

From your description, I understand you've developed an http
request/response utility component library for your classic ASP application
through .net framework 1.1. It works well until you installed the .net
framework 2.0 and SQL Server 2005 tools on the server, after that you keep
getting "The underlying connection was closed: Could not establish secure
channel for SSL/TLS" error, correct? If anything I missed ,please feel free
to post here.

Based on my experience, this is likely a .net framework versioning issue
caused by the newly installed .net framework 2.0 on your server machine. As
for unmanaged applications which call .net components through COM interop,
it will load the latest version of .net framework by default. Therefore,
for your scenario, after you've installed .net 2.0 on that machine, your
classic ASP should be loading the .net framework 2.0 though your http
utlity library is built through .net framework 1.1. (Anyway break change in
the classes you've used will make the execution fails):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/ht
ml/sidexsidenet.asp

To verify this, you can printout the current .net runtime version in your
utility class through "System.Environment.Version".

Also, for configuring the ASP hoster application to target a specific
version of .net framework , we need to idenitify the ASP's host program
image file( inetinfo.exe or dllhost.exe) and provide a imagename.exe.config
file which contains the version
configuration element:

How to: Use an Application Configuration File to Target a .NET Framework
Version
http://msdn2.microsoft.com/en-us/library/9w519wzk.aspx

Anyway, I suggest you first check and confirm the problem behavior and
cause so that we can perform further action according to it. BTW, IIS log
is also useful to identify what error occurs when IIS server try processing
the client http requests.

Hope this helps. If you have any further finding, please feel free to post
here.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
J

Jim Butler

Steven,

It is definitely running under the 2.0 framework. Currently, we have
dllhost.exe and w3wp.exe running. I would assume it would be dllhost to
choose, but how can i tell for sure. Also, should this be what the file
should look like, and i assume it should be copied to where the exe lives
(c:\windows\system32)

dllhost.exe.config
<?xml version ="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v1.1.4322" />
</startup>
</configuration>

Thanks,

jim
 
J

Jim Butler

Stephen,

I was able to create the w3wp.exe.config file with the section below (now
the asp code that is accessing the com visible net class is running the 1.1
framework). I do have a concern as to how this will impact other .net web
apps we have on the server if at all? We have 2 other .net 2.0 framework
apps (no asp in them at all, 100% .net 2.0) currently, they run in different
application pools. Will this change only impact unmanaged code accessing
managed code?

thanks for the answers

jim
 
S

Steven Cheng[MSFT]

Thanks for your prompt reply Jim,

For your further questions and concerns, here are my understanding and
suggestion in line:


I was able to create the w3wp.exe.config file with the section below (now
the asp code that is accessing the com visible net class is running the 1.1
framework).
==================================
Glad that you've found the w3wp.exe process, actually I did miss it in the
last message. w3wp.exe is the worker process of IIS6(for both ASP and
ASP.NET).


I do have a concern as to how this will impact other .net web
apps we have on the server if at all? We have 2 other .net 2.0 framework
apps (no asp in them at all, 100% .net 2.0) currently, they run in
different
application pools. Will this change only impact unmanaged code accessing
managed code?
==================================

For IIS6, it is a particular case because both classic ASP and ASP.NET will
be hosted in W3WP.exe process. However, ASP.NET's versioning setting is
controlled by the extension dll mapping in IIS's virtual directory
setting(you can find it in the IIS manager's virtual directory
configuration tab). And our manually added w3wp.exe.config will only
affect those unmanaged applications(hosted in w3wp.exe) and call .net
component through COM interop. I've just performed some smiple test on my
side and the ASP.NET application can running upon .net framework 2.0
regardless the 1.1 setting I put in w3wp.exe.config file. Anyway, I
suggest you configure ASP.NET and classic ASP applications(virtual
directory) to use separate application pool in IIS.

In addition, have you considered recompiling your utility class component
under .net framework 2.0 so as to make them working naturally under the
latest .net runtime? If this is possible for your current project plan, I
would recommend this since that can avoid using an additional config file
for w3wp.exe image.

Please feel free to let me know if you have any other concerns.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
J

Jim Butler

Stephen,

Thanks for all your help, we will upgrading that part of the app from asp to
2.0, but it's a long project, roughly 2 years (to get it through testing)
and it is essential for the asp to work, so we will be using the config file
for now and upgrading during the major rewrite project.

thanks again,

jim butler
 
S

Steven Cheng[MSFT]

Thanks for your followup Jim,

I can understand your decision. Anyway, if you meet any further problem or
need any other helps on this, please feel free to post here.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top