socket error

G

Guest

Hi all,

I have a simple .aspx page running on net 2.0 that is trying to do a http
post to a remote server. Here is the code

Private Function ProcessRequests(ByVal strbody As String) As String

Dim returnstr As String

Dim URL As String = "http://www.dydomain.com/test.asp"

Dim h As HttpWebRequest = CType(WebRequest.Create(URL), HttpWebRequest)

h.ContentType = "text/xml"

h.Method = "POST"

h.ContentLength = Len(strbody)

h.KeepAlive = True

h.Referer = "me"

h.UserAgent = "me"

Dim s As Stream = h.GetRequestStream()

Dim sw As New StreamWriter(s)

sw.Write(strbody)

sw.Close()

Dim hr As HttpWebResponse = CType(h.GetResponse, HttpWebResponse)

Dim s2 As Stream = hr.GetResponseStream

Dim sr As New StreamReader(s2)

returnstr = sr.ReadToEnd

sr.Close()

h = Nothing

hr.Close()

hr = Nothing

funcend:

Return returnstr

End Function



I get an error on the following line:-





Server Error in '/' Application.
--------------------------------------------------------------------------------

A socket operation encountered a dead network
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: A socket operation
encountered a dead network

Source Error:

Line 111: h.UserAgent = "me"
Line 112:
Line 113: Dim s As Stream = h.GetRequestStream()
Line 114: Dim sw As New StreamWriter(s)
Line 115: sw.Write(strbody)

Source File: D:\Website Files\AppOne v2.0\appone remoting\Default.aspx.vb
Line: 113

Stack Trace:

[SocketException (0x2742): A socket operation encountered a dead network]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
SocketAddress socketAddress) +1002146
System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +33
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,
Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState
state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +431

[WebException: Unable to connect to the remote server]
System.Net.HttpWebRequest.GetRequestStream() +1504525
_Default.ProcessRequests(Int32 lenderID, String strbody) in D:\Website
Files\AppOne v2.0\appone remoting\Default.aspx.vb:113
_Default.CheckNADAProvider() in D:\Website Files\AppOne v2.0\appone
remoting\Default.aspx.vb:97
_Default.Page_Load(Object sender, EventArgs e) in D:\Website Files\AppOne
v2.0\appone remoting\Default.aspx.vb:15
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061





--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.42



This same code works on a .net 1.1 box on the same network. So I know
outbound access is OK. Any ideas? The box with the problems is running
Server 2003 Enterprise SP1 w/ net 2.0 RTM.

TIA!
 
S

Steven Cheng[MSFT]

Hi Param,

Welcome.
From your description, you're using HttpWebRequest component to
programmatically request an ASP page and encounter underlying connection
closed problem. From the code snippet you provided, seems there hasn't any
particular things, I'd suggest you try the following things:

1. Whether you can visit that page correctly through browser
2. Whether you can correctly request that page through the same code in a
winform or console application.

Also, if convenient, would you also provide the detailed authentication
setting for that ASP page 's IIS virtual dir?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: <[email protected]>
| Subject: socket error
| Date: Thu, 10 Nov 2005 23:24:46 -0600
| Lines: 126
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:357281
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi all,
|
| I have a simple .aspx page running on net 2.0 that is trying to do a http
| post to a remote server. Here is the code
|
| Private Function ProcessRequests(ByVal strbody As String) As String
|
| Dim returnstr As String
|
| Dim URL As String = "http://www.dydomain.com/test.asp"
|
| Dim h As HttpWebRequest = CType(WebRequest.Create(URL), HttpWebRequest)
|
| h.ContentType = "text/xml"
|
| h.Method = "POST"
|
| h.ContentLength = Len(strbody)
|
| h.KeepAlive = True
|
| h.Referer = "me"
|
| h.UserAgent = "me"
|
| Dim s As Stream = h.GetRequestStream()
|
| Dim sw As New StreamWriter(s)
|
| sw.Write(strbody)
|
| sw.Close()
|
| Dim hr As HttpWebResponse = CType(h.GetResponse, HttpWebResponse)
|
| Dim s2 As Stream = hr.GetResponseStream
|
| Dim sr As New StreamReader(s2)
|
| returnstr = sr.ReadToEnd
|
| sr.Close()
|
| h = Nothing
|
| hr.Close()
|
| hr = Nothing
|
| funcend:
|
| Return returnstr
|
| End Function
|
|
|
| I get an error on the following line:-
|
|
|
|
|
| Server Error in '/' Application.
|
----------------------------------------------------------------------------
----
|
| A socket operation encountered a dead network
| Description: An unhandled exception occurred during the execution of the
| current web request. Please review the stack trace for more information
| about the error and where it originated in the code.
|
| Exception Details: System.Net.Sockets.SocketException: A socket operation
| encountered a dead network
|
| Source Error:
|
| Line 111: h.UserAgent = "me"
| Line 112:
| Line 113: Dim s As Stream = h.GetRequestStream()
| Line 114: Dim sw As New StreamWriter(s)
| Line 115: sw.Write(strbody)
|
| Source File: D:\Website Files\AppOne v2.0\appone remoting\Default.aspx.vb
| Line: 113
|
| Stack Trace:
|
| [SocketException (0x2742): A socket operation encountered a dead network]
| System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
| SocketAddress socketAddress) +1002146
| System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +33
| System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,
| Socket s4, Socket s6, Socket& socket, IPAddress& address,
ConnectSocketState
| state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +431
|
| [WebException: Unable to connect to the remote server]
| System.Net.HttpWebRequest.GetRequestStream() +1504525
| _Default.ProcessRequests(Int32 lenderID, String strbody) in D:\Website
| Files\AppOne v2.0\appone remoting\Default.aspx.vb:113
| _Default.CheckNADAProvider() in D:\Website Files\AppOne v2.0\appone
| remoting\Default.aspx.vb:97
| _Default.Page_Load(Object sender, EventArgs e) in D:\Website
Files\AppOne
| v2.0\appone remoting\Default.aspx.vb:15
| System.Web.UI.Control.OnLoad(EventArgs e) +99
| System.Web.UI.Control.LoadRecursive() +47
| System.Web.UI.Page.ProcessRequestMain(Boolean
| includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
|
|
|
|
|
|
----------------------------------------------------------------------------
----
|
| Version Information: Microsoft .NET Framework Version:2.0.50727.42;
ASP.NET
| Version:2.0.50727.42
|
|
|
| This same code works on a .net 1.1 box on the same network. So I know
| outbound access is OK. Any ideas? The box with the problems is running
| Server 2003 Enterprise SP1 w/ net 2.0 RTM.
|
| TIA!
|
|
|
 
G

Guest

Steve,

1. Yes I can visit that page directly through a browser on the server.
2. The same code snippet works on another server on the same network running
net 1.1.
3. The vdir is running with anonymous authentication turned on. It's
application pool is configured to run under a normal user account named
"appone".

I cant think of anything else?

Steven Cheng said:
Hi Param,

Welcome.
From your description, you're using HttpWebRequest component to
programmatically request an ASP page and encounter underlying connection
closed problem. From the code snippet you provided, seems there hasn't
any
particular things, I'd suggest you try the following things:

1. Whether you can visit that page correctly through browser
2. Whether you can correctly request that page through the same code in a
winform or console application.

Also, if convenient, would you also provide the detailed authentication
setting for that ASP page 's IIS virtual dir?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: <[email protected]>
| Subject: socket error
| Date: Thu, 10 Nov 2005 23:24:46 -0600
| Lines: 126
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:357281
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi all,
|
| I have a simple .aspx page running on net 2.0 that is trying to do a
http
| post to a remote server. Here is the code
|
| Private Function ProcessRequests(ByVal strbody As String) As String
|
| Dim returnstr As String
|
| Dim URL As String = "http://www.dydomain.com/test.asp"
|
| Dim h As HttpWebRequest = CType(WebRequest.Create(URL), HttpWebRequest)
|
| h.ContentType = "text/xml"
|
| h.Method = "POST"
|
| h.ContentLength = Len(strbody)
|
| h.KeepAlive = True
|
| h.Referer = "me"
|
| h.UserAgent = "me"
|
| Dim s As Stream = h.GetRequestStream()
|
| Dim sw As New StreamWriter(s)
|
| sw.Write(strbody)
|
| sw.Close()
|
| Dim hr As HttpWebResponse = CType(h.GetResponse, HttpWebResponse)
|
| Dim s2 As Stream = hr.GetResponseStream
|
| Dim sr As New StreamReader(s2)
|
| returnstr = sr.ReadToEnd
|
| sr.Close()
|
| h = Nothing
|
| hr.Close()
|
| hr = Nothing
|
| funcend:
|
| Return returnstr
|
| End Function
|
|
|
| I get an error on the following line:-
|
|
|
|
|
| Server Error in '/' Application.
|
----------------------------------------------------------------------------
----
|
| A socket operation encountered a dead network
| Description: An unhandled exception occurred during the execution of the
| current web request. Please review the stack trace for more information
| about the error and where it originated in the code.
|
| Exception Details: System.Net.Sockets.SocketException: A socket
operation
| encountered a dead network
|
| Source Error:
|
| Line 111: h.UserAgent = "me"
| Line 112:
| Line 113: Dim s As Stream = h.GetRequestStream()
| Line 114: Dim sw As New StreamWriter(s)
| Line 115: sw.Write(strbody)
|
| Source File: D:\Website Files\AppOne v2.0\appone
remoting\Default.aspx.vb
| Line: 113
|
| Stack Trace:
|
| [SocketException (0x2742): A socket operation encountered a dead
network]
| System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
| SocketAddress socketAddress) +1002146
| System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +33
| System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,
| Socket s4, Socket s6, Socket& socket, IPAddress& address,
ConnectSocketState
| state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
+431
|
| [WebException: Unable to connect to the remote server]
| System.Net.HttpWebRequest.GetRequestStream() +1504525
| _Default.ProcessRequests(Int32 lenderID, String strbody) in
D:\Website
| Files\AppOne v2.0\appone remoting\Default.aspx.vb:113
| _Default.CheckNADAProvider() in D:\Website Files\AppOne v2.0\appone
| remoting\Default.aspx.vb:97
| _Default.Page_Load(Object sender, EventArgs e) in D:\Website
Files\AppOne
| v2.0\appone remoting\Default.aspx.vb:15
| System.Web.UI.Control.OnLoad(EventArgs e) +99
| System.Web.UI.Control.LoadRecursive() +47
| System.Web.UI.Page.ProcessRequestMain(Boolean
| includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1061
|
|
|
|
|
|
----------------------------------------------------------------------------
----
|
| Version Information: Microsoft .NET Framework Version:2.0.50727.42;
ASP.NET
| Version:2.0.50727.42
|
|
|
| This same code works on a .net 1.1 box on the same network. So I know
| outbound access is OK. Any ideas? The box with the problems is running
| Server 2003 Enterprise SP1 w/ net 2.0 RTM.
|
| TIA!
|
|
|
 
G

Guest

It ended up with something to do with our Proxy configuration. On both the
1.1 & 2.0 boxes I had the MS Firewall Client installed. This worked fine on
the 1.1 box, but on the 2.0 box for some reason the httpwebrequest couldnt
get out. I un-installed the firewall client on the 2.0 box and it ended up
working fine? Our proxy server (isa 2004) was configured to allow all
outbound connections for both the boxes. So I dont see where the problem
was?

TIA!

Steve,

1. Yes I can visit that page directly through a browser on the server.
2. The same code snippet works on another server on the same network
running net 1.1.
3. The vdir is running with anonymous authentication turned on. It's
application pool is configured to run under a normal user account named
"appone".

I cant think of anything else?

Steven Cheng said:
Hi Param,

Welcome.
From your description, you're using HttpWebRequest component to
programmatically request an ASP page and encounter underlying connection
closed problem. From the code snippet you provided, seems there hasn't
any
particular things, I'd suggest you try the following things:

1. Whether you can visit that page correctly through browser
2. Whether you can correctly request that page through the same code in a
winform or console application.

Also, if convenient, would you also provide the detailed authentication
setting for that ASP page 's IIS virtual dir?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: <[email protected]>
| Subject: socket error
| Date: Thu, 10 Nov 2005 23:24:46 -0600
| Lines: 126
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:357281
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi all,
|
| I have a simple .aspx page running on net 2.0 that is trying to do a
http
| post to a remote server. Here is the code
|
| Private Function ProcessRequests(ByVal strbody As String) As String
|
| Dim returnstr As String
|
| Dim URL As String = "http://www.dydomain.com/test.asp"
|
| Dim h As HttpWebRequest = CType(WebRequest.Create(URL), HttpWebRequest)
|
| h.ContentType = "text/xml"
|
| h.Method = "POST"
|
| h.ContentLength = Len(strbody)
|
| h.KeepAlive = True
|
| h.Referer = "me"
|
| h.UserAgent = "me"
|
| Dim s As Stream = h.GetRequestStream()
|
| Dim sw As New StreamWriter(s)
|
| sw.Write(strbody)
|
| sw.Close()
|
| Dim hr As HttpWebResponse = CType(h.GetResponse, HttpWebResponse)
|
| Dim s2 As Stream = hr.GetResponseStream
|
| Dim sr As New StreamReader(s2)
|
| returnstr = sr.ReadToEnd
|
| sr.Close()
|
| h = Nothing
|
| hr.Close()
|
| hr = Nothing
|
| funcend:
|
| Return returnstr
|
| End Function
|
|
|
| I get an error on the following line:-
|
|
|
|
|
| Server Error in '/' Application.
|
----------------------------------------------------------------------------
----
|
| A socket operation encountered a dead network
| Description: An unhandled exception occurred during the execution of
the
| current web request. Please review the stack trace for more information
| about the error and where it originated in the code.
|
| Exception Details: System.Net.Sockets.SocketException: A socket
operation
| encountered a dead network
|
| Source Error:
|
| Line 111: h.UserAgent = "me"
| Line 112:
| Line 113: Dim s As Stream = h.GetRequestStream()
| Line 114: Dim sw As New StreamWriter(s)
| Line 115: sw.Write(strbody)
|
| Source File: D:\Website Files\AppOne v2.0\appone
remoting\Default.aspx.vb
| Line: 113
|
| Stack Trace:
|
| [SocketException (0x2742): A socket operation encountered a dead
network]
| System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
| SocketAddress socketAddress) +1002146
| System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +33
| System.Net.ServicePoint.ConnectSocketInternal(Boolean
connectFailure,
| Socket s4, Socket s6, Socket& socket, IPAddress& address,
ConnectSocketState
| state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
+431
|
| [WebException: Unable to connect to the remote server]
| System.Net.HttpWebRequest.GetRequestStream() +1504525
| _Default.ProcessRequests(Int32 lenderID, String strbody) in
D:\Website
| Files\AppOne v2.0\appone remoting\Default.aspx.vb:113
| _Default.CheckNADAProvider() in D:\Website Files\AppOne v2.0\appone
| remoting\Default.aspx.vb:97
| _Default.Page_Load(Object sender, EventArgs e) in D:\Website
Files\AppOne
| v2.0\appone remoting\Default.aspx.vb:15
| System.Web.UI.Control.OnLoad(EventArgs e) +99
| System.Web.UI.Control.LoadRecursive() +47
| System.Web.UI.Page.ProcessRequestMain(Boolean
| includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1061
|
|
|
|
|
|
----------------------------------------------------------------------------
----
|
| Version Information: Microsoft .NET Framework Version:2.0.50727.42;
ASP.NET
| Version:2.0.50727.42
|
|
|
| This same code works on a .net 1.1 box on the same network. So I know
| outbound access is OK. Any ideas? The box with the problems is running
| Server 2003 Enterprise SP1 w/ net 2.0 RTM.
|
| TIA!
|
|
|
 
S

Steven Cheng[MSFT]

Hi Param,

Thanks for your followup.
I think the behavior you mentioned could be caused by the new configuration
of the
<system.net><defaultProxy>.......

in .net 2.0, which will use the IE setting if there is not default proxy
configured...
In .net 1.1, there is default setting in machine.config which point the
default proxy setting is:

<sytem.net>
....
<defaultProxy>
<proxy usesystemdefault="true"/>
...........


while in .NET 2.0, this is not configured by default in the machine.config.
You can check the setting on your deve machine's machine.config. Also,
you can override this setting in your Application's application config file
/web.config file...

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: <[email protected]>
| References: <#[email protected]>
<q4h#[email protected]>
<[email protected]>
| Subject: Re: socket error
| Date: Sat, 12 Nov 2005 14:20:45 -0600
| Lines: 215
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| X-RFC2646: Format=Flowed; Response
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: corp2.lazardgroup.com 70.182.148.88
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:357660
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| It ended up with something to do with our Proxy configuration. On both
the
| 1.1 & 2.0 boxes I had the MS Firewall Client installed. This worked fine
on
| the 1.1 box, but on the 2.0 box for some reason the httpwebrequest
couldnt
| get out. I un-installed the firewall client on the 2.0 box and it ended
up
| working fine? Our proxy server (isa 2004) was configured to allow all
| outbound connections for both the boxes. So I dont see where the problem
| was?
|
| TIA!
|
| | > Steve,
| >
| > 1. Yes I can visit that page directly through a browser on the server.
| > 2. The same code snippet works on another server on the same network
| > running net 1.1.
| > 3. The vdir is running with anonymous authentication turned on. It's
| > application pool is configured to run under a normal user account named
| > "appone".
| >
| > I cant think of anything else?
| >
| > | >> Hi Param,
| >>
| >> Welcome.
| >> From your description, you're using HttpWebRequest component to
| >> programmatically request an ASP page and encounter underlying
connection
| >> closed problem. From the code snippet you provided, seems there
hasn't
| >> any
| >> particular things, I'd suggest you try the following things:
| >>
| >> 1. Whether you can visit that page correctly through browser
| >> 2. Whether you can correctly request that page through the same code
in a
| >> winform or console application.
| >>
| >> Also, if convenient, would you also provide the detailed authentication
| >> setting for that ASP page 's IIS virtual dir?
| >>
| >> Thanks,
| >>
| >> Steven Cheng
| >> Microsoft Online Support
| >>
| >> Get Secure! www.microsoft.com/security
| >> (This posting is provided "AS IS", with no warranties, and confers no
| >> rights.)
| >> --------------------
| >> | From: <[email protected]>
| >> | Subject: socket error
| >> | Date: Thu, 10 Nov 2005 23:24:46 -0600
| >> | Lines: 126
| >> | X-Priority: 3
| >> | X-MSMail-Priority: Normal
| >> | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| >> | X-RFC2646: Format=Flowed; Original
| >> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| >> | Message-ID: <#[email protected]>
| >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
| >> | NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| >> | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| >> | Xref: TK2MSFTNGXA02.phx.gbl
| >> microsoft.public.dotnet.framework.aspnet:357281
| >> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| >> |
| >> | Hi all,
| >> |
| >> | I have a simple .aspx page running on net 2.0 that is trying to do a
| >> http
| >> | post to a remote server. Here is the code
| >> |
| >> | Private Function ProcessRequests(ByVal strbody As String) As String
| >> |
| >> | Dim returnstr As String
| >> |
| >> | Dim URL As String = "http://www.dydomain.com/test.asp"
| >> |
| >> | Dim h As HttpWebRequest = CType(WebRequest.Create(URL),
HttpWebRequest)
| >> |
| >> | h.ContentType = "text/xml"
| >> |
| >> | h.Method = "POST"
| >> |
| >> | h.ContentLength = Len(strbody)
| >> |
| >> | h.KeepAlive = True
| >> |
| >> | h.Referer = "me"
| >> |
| >> | h.UserAgent = "me"
| >> |
| >> | Dim s As Stream = h.GetRequestStream()
| >> |
| >> | Dim sw As New StreamWriter(s)
| >> |
| >> | sw.Write(strbody)
| >> |
| >> | sw.Close()
| >> |
| >> | Dim hr As HttpWebResponse = CType(h.GetResponse, HttpWebResponse)
| >> |
| >> | Dim s2 As Stream = hr.GetResponseStream
| >> |
| >> | Dim sr As New StreamReader(s2)
| >> |
| >> | returnstr = sr.ReadToEnd
| >> |
| >> | sr.Close()
| >> |
| >> | h = Nothing
| >> |
| >> | hr.Close()
| >> |
| >> | hr = Nothing
| >> |
| >> | funcend:
| >> |
| >> | Return returnstr
| >> |
| >> | End Function
| >> |
| >> |
| >> |
| >> | I get an error on the following line:-
| >> |
| >> |
| >> |
| >> |
| >> |
| >> | Server Error in '/' Application.
| >> |
| >>
----------------------------------------------------------------------------
| >> ----
| >> |
| >> | A socket operation encountered a dead network
| >> | Description: An unhandled exception occurred during the execution of
| >> the
| >> | current web request. Please review the stack trace for more
information
| >> | about the error and where it originated in the code.
| >> |
| >> | Exception Details: System.Net.Sockets.SocketException: A socket
| >> operation
| >> | encountered a dead network
| >> |
| >> | Source Error:
| >> |
| >> | Line 111: h.UserAgent = "me"
| >> | Line 112:
| >> | Line 113: Dim s As Stream = h.GetRequestStream()
| >> | Line 114: Dim sw As New StreamWriter(s)
| >> | Line 115: sw.Write(strbody)
| >> |
| >> | Source File: D:\Website Files\AppOne v2.0\appone
| >> remoting\Default.aspx.vb
| >> | Line: 113
| >> |
| >> | Stack Trace:
| >> |
| >> | [SocketException (0x2742): A socket operation encountered a dead
| >> network]
| >> | System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
| >> | SocketAddress socketAddress) +1002146
| >> | System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +33
| >> | System.Net.ServicePoint.ConnectSocketInternal(Boolean
| >> connectFailure,
| >> | Socket s4, Socket s6, Socket& socket, IPAddress& address,
| >> ConnectSocketState
| >> | state, IAsyncResult asyncResult, Int32 timeout, Exception&
exception)
| >> +431
| >> |
| >> | [WebException: Unable to connect to the remote server]
| >> | System.Net.HttpWebRequest.GetRequestStream() +1504525
| >> | _Default.ProcessRequests(Int32 lenderID, String strbody) in
| >> D:\Website
| >> | Files\AppOne v2.0\appone remoting\Default.aspx.vb:113
| >> | _Default.CheckNADAProvider() in D:\Website Files\AppOne
v2.0\appone
| >> | remoting\Default.aspx.vb:97
| >> | _Default.Page_Load(Object sender, EventArgs e) in D:\Website
| >> Files\AppOne
| >> | v2.0\appone remoting\Default.aspx.vb:15
| >> | System.Web.UI.Control.OnLoad(EventArgs e) +99
| >> | System.Web.UI.Control.LoadRecursive() +47
| >> | System.Web.UI.Page.ProcessRequestMain(Boolean
| >> | includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
| >> +1061
| >> |
| >> |
| >> |
| >> |
| >> |
| >> |
| >>
----------------------------------------------------------------------------
| >> ----
| >> |
| >> | Version Information: Microsoft .NET Framework Version:2.0.50727.42;
| >> ASP.NET
| >> | Version:2.0.50727.42
| >> |
| >> |
| >> |
| >> | This same code works on a .net 1.1 box on the same network. So I know
| >> | outbound access is OK. Any ideas? The box with the problems is
running
| >> | Server 2003 Enterprise SP1 w/ net 2.0 RTM.
| >> |
| >> | TIA!
| >> |
| >> |
| >> |
| >>
| >
| >
|
|
|
 
S

Steven Cheng[MSFT]

Hi Param,

Does the further infomation in my last reply helps? If anything else we can
help, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 52205220
| References: <#[email protected]>
<q4h#[email protected]>
<[email protected]>
<[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Mon, 14 Nov 2005 03:06:48 GMT
| Subject: Re: socket error
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Lines: 222
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:357811
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi Param,
|
| Thanks for your followup.
| I think the behavior you mentioned could be caused by the new
configuration
| of the
| <system.net><defaultProxy>.......
|
| in .net 2.0, which will use the IE setting if there is not default proxy
| configured...
| In .net 1.1, there is default setting in machine.config which point the
| default proxy setting is:
|
| <sytem.net>
| ...
| <defaultProxy>
| <proxy usesystemdefault="true"/>
| ..........
|
|
| while in .NET 2.0, this is not configured by default in the
machine.config.
| You can check the setting on your deve machine's machine.config. Also,
| you can override this setting in your Application's application config
file
| /web.config file...
|
| Hope helps. Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
| --------------------
| | From: <[email protected]>
| | References: <#[email protected]>
| <q4h#[email protected]>
| <[email protected]>
| | Subject: Re: socket error
| | Date: Sat, 12 Nov 2005 14:20:45 -0600
| | Lines: 215
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| | X-RFC2646: Format=Flowed; Response
| | Message-ID: <[email protected]>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | NNTP-Posting-Host: corp2.lazardgroup.com 70.182.148.88
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| | Xref: TK2MSFTNGXA02.phx.gbl
| microsoft.public.dotnet.framework.aspnet:357660
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | It ended up with something to do with our Proxy configuration. On both
| the
| | 1.1 & 2.0 boxes I had the MS Firewall Client installed. This worked
fine
| on
| | the 1.1 box, but on the 2.0 box for some reason the httpwebrequest
| couldnt
| | get out. I un-installed the firewall client on the 2.0 box and it ended
| up
| | working fine? Our proxy server (isa 2004) was configured to allow all
| | outbound connections for both the boxes. So I dont see where the
problem
| | was?
| |
| | TIA!
| |
| | | | > Steve,
| | >
| | > 1. Yes I can visit that page directly through a browser on the server.
| | > 2. The same code snippet works on another server on the same network
| | > running net 1.1.
| | > 3. The vdir is running with anonymous authentication turned on. It's
| | > application pool is configured to run under a normal user account
named
| | > "appone".
| | >
| | > I cant think of anything else?
| | >
| | > | | >> Hi Param,
| | >>
| | >> Welcome.
| | >> From your description, you're using HttpWebRequest component to
| | >> programmatically request an ASP page and encounter underlying
| connection
| | >> closed problem. From the code snippet you provided, seems there
| hasn't
| | >> any
| | >> particular things, I'd suggest you try the following things:
| | >>
| | >> 1. Whether you can visit that page correctly through browser
| | >> 2. Whether you can correctly request that page through the same code
| in a
| | >> winform or console application.
| | >>
| | >> Also, if convenient, would you also provide the detailed
authentication
| | >> setting for that ASP page 's IIS virtual dir?
| | >>
| | >> Thanks,
| | >>
| | >> Steven Cheng
| | >> Microsoft Online Support
| | >>
| | >> Get Secure! www.microsoft.com/security
| | >> (This posting is provided "AS IS", with no warranties, and confers no
| | >> rights.)
| | >> --------------------
| | >> | From: <[email protected]>
| | >> | Subject: socket error
| | >> | Date: Thu, 10 Nov 2005 23:24:46 -0600
| | >> | Lines: 126
| | >> | X-Priority: 3
| | >> | X-MSMail-Priority: Normal
| | >> | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| | >> | X-RFC2646: Format=Flowed; Original
| | >> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| | >> | Message-ID: <#[email protected]>
| | >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | >> | NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| | >> | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| | >> | Xref: TK2MSFTNGXA02.phx.gbl
| | >> microsoft.public.dotnet.framework.aspnet:357281
| | >> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| | >> |
| | >> | Hi all,
| | >> |
| | >> | I have a simple .aspx page running on net 2.0 that is trying to do
a
| | >> http
| | >> | post to a remote server. Here is the code
| | >> |
| | >> | Private Function ProcessRequests(ByVal strbody As String) As String
| | >> |
| | >> | Dim returnstr As String
| | >> |
| | >> | Dim URL As String = "http://www.dydomain.com/test.asp"
| | >> |
| | >> | Dim h As HttpWebRequest = CType(WebRequest.Create(URL),
| HttpWebRequest)
| | >> |
| | >> | h.ContentType = "text/xml"
| | >> |
| | >> | h.Method = "POST"
| | >> |
| | >> | h.ContentLength = Len(strbody)
| | >> |
| | >> | h.KeepAlive = True
| | >> |
| | >> | h.Referer = "me"
| | >> |
| | >> | h.UserAgent = "me"
| | >> |
| | >> | Dim s As Stream = h.GetRequestStream()
| | >> |
| | >> | Dim sw As New StreamWriter(s)
| | >> |
| | >> | sw.Write(strbody)
| | >> |
| | >> | sw.Close()
| | >> |
| | >> | Dim hr As HttpWebResponse = CType(h.GetResponse, HttpWebResponse)
| | >> |
| | >> | Dim s2 As Stream = hr.GetResponseStream
| | >> |
| | >> | Dim sr As New StreamReader(s2)
| | >> |
| | >> | returnstr = sr.ReadToEnd
| | >> |
| | >> | sr.Close()
| | >> |
| | >> | h = Nothing
| | >> |
| | >> | hr.Close()
| | >> |
| | >> | hr = Nothing
| | >> |
| | >> | funcend:
| | >> |
| | >> | Return returnstr
| | >> |
| | >> | End Function
| | >> |
| | >> |
| | >> |
| | >> | I get an error on the following line:-
| | >> |
| | >> |
| | >> |
| | >> |
| | >> |
| | >> | Server Error in '/' Application.
| | >> |
| | >>
|
----------------------------------------------------------------------------
| | >> ----
| | >> |
| | >> | A socket operation encountered a dead network
| | >> | Description: An unhandled exception occurred during the execution
of
| | >> the
| | >> | current web request. Please review the stack trace for more
| information
| | >> | about the error and where it originated in the code.
| | >> |
| | >> | Exception Details: System.Net.Sockets.SocketException: A socket
| | >> operation
| | >> | encountered a dead network
| | >> |
| | >> | Source Error:
| | >> |
| | >> | Line 111: h.UserAgent = "me"
| | >> | Line 112:
| | >> | Line 113: Dim s As Stream = h.GetRequestStream()
| | >> | Line 114: Dim sw As New StreamWriter(s)
| | >> | Line 115: sw.Write(strbody)
| | >> |
| | >> | Source File: D:\Website Files\AppOne v2.0\appone
| | >> remoting\Default.aspx.vb
| | >> | Line: 113
| | >> |
| | >> | Stack Trace:
| | >> |
| | >> | [SocketException (0x2742): A socket operation encountered a dead
| | >> network]
| | >> | System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
| | >> | SocketAddress socketAddress) +1002146
| | >> | System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +33
| | >> | System.Net.ServicePoint.ConnectSocketInternal(Boolean
| | >> connectFailure,
| | >> | Socket s4, Socket s6, Socket& socket, IPAddress& address,
| | >> ConnectSocketState
| | >> | state, IAsyncResult asyncResult, Int32 timeout, Exception&
| exception)
| | >> +431
| | >> |
| | >> | [WebException: Unable to connect to the remote server]
| | >> | System.Net.HttpWebRequest.GetRequestStream() +1504525
| | >> | _Default.ProcessRequests(Int32 lenderID, String strbody) in
| | >> D:\Website
| | >> | Files\AppOne v2.0\appone remoting\Default.aspx.vb:113
| | >> | _Default.CheckNADAProvider() in D:\Website Files\AppOne
| v2.0\appone
| | >> | remoting\Default.aspx.vb:97
| | >> | _Default.Page_Load(Object sender, EventArgs e) in D:\Website
| | >> Files\AppOne
| | >> | v2.0\appone remoting\Default.aspx.vb:15
| | >> | System.Web.UI.Control.OnLoad(EventArgs e) +99
| | >> | System.Web.UI.Control.LoadRecursive() +47
| | >> | System.Web.UI.Page.ProcessRequestMain(Boolean
| | >> | includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint)
| | >> +1061
| | >> |
| | >> |
| | >> |
| | >> |
| | >> |
| | >> |
| | >>
|
----------------------------------------------------------------------------
| | >> ----
| | >> |
| | >> | Version Information: Microsoft .NET Framework Version:2.0.50727.42;
| | >> ASP.NET
| | >> | Version:2.0.50727.42
| | >> |
| | >> |
| | >> |
| | >> | This same code works on a .net 1.1 box on the same network. So I
know
| | >> | outbound access is OK. Any ideas? The box with the problems is
| running
| | >> | Server 2003 Enterprise SP1 w/ net 2.0 RTM.
| | >> |
| | >> | TIA!
| | >> |
| | >> |
| | >> |
| | >>
| | >
| | >
| |
| |
| |
|
|
 
G

Guest

Yes it does. thanks

Steven Cheng said:
Hi Param,

Does the further infomation in my last reply helps? If anything else we
can
help, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 52205220
| References: <#[email protected]>
<q4h#[email protected]>
<[email protected]>
<[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Mon, 14 Nov 2005 03:06:48 GMT
| Subject: Re: socket error
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Lines: 222
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:357811
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi Param,
|
| Thanks for your followup.
| I think the behavior you mentioned could be caused by the new
configuration
| of the
| <system.net><defaultProxy>.......
|
| in .net 2.0, which will use the IE setting if there is not default proxy
| configured...
| In .net 1.1, there is default setting in machine.config which point the
| default proxy setting is:
|
| <sytem.net>
| ...
| <defaultProxy>
| <proxy usesystemdefault="true"/>
| ..........
|
|
| while in .NET 2.0, this is not configured by default in the
machine.config.
| You can check the setting on your deve machine's machine.config. Also,
| you can override this setting in your Application's application config
file
| /web.config file...
|
| Hope helps. Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
| --------------------
| | From: <[email protected]>
| | References: <#[email protected]>
| <q4h#[email protected]>
| <[email protected]>
| | Subject: Re: socket error
| | Date: Sat, 12 Nov 2005 14:20:45 -0600
| | Lines: 215
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| | X-RFC2646: Format=Flowed; Response
| | Message-ID: <[email protected]>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | NNTP-Posting-Host: corp2.lazardgroup.com 70.182.148.88
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| | Xref: TK2MSFTNGXA02.phx.gbl
| microsoft.public.dotnet.framework.aspnet:357660
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | It ended up with something to do with our Proxy configuration. On both
| the
| | 1.1 & 2.0 boxes I had the MS Firewall Client installed. This worked
fine
| on
| | the 1.1 box, but on the 2.0 box for some reason the httpwebrequest
| couldnt
| | get out. I un-installed the firewall client on the 2.0 box and it
ended
| up
| | working fine? Our proxy server (isa 2004) was configured to allow all
| | outbound connections for both the boxes. So I dont see where the
problem
| | was?
| |
| | TIA!
| |
| | | | > Steve,
| | >
| | > 1. Yes I can visit that page directly through a browser on the
server.
| | > 2. The same code snippet works on another server on the same network
| | > running net 1.1.
| | > 3. The vdir is running with anonymous authentication turned on. It's
| | > application pool is configured to run under a normal user account
named
| | > "appone".
| | >
| | > I cant think of anything else?
| | >
| | > | | >> Hi Param,
| | >>
| | >> Welcome.
| | >> From your description, you're using HttpWebRequest component to
| | >> programmatically request an ASP page and encounter underlying
| connection
| | >> closed problem. From the code snippet you provided, seems there
| hasn't
| | >> any
| | >> particular things, I'd suggest you try the following things:
| | >>
| | >> 1. Whether you can visit that page correctly through browser
| | >> 2. Whether you can correctly request that page through the same
code
| in a
| | >> winform or console application.
| | >>
| | >> Also, if convenient, would you also provide the detailed
authentication
| | >> setting for that ASP page 's IIS virtual dir?
| | >>
| | >> Thanks,
| | >>
| | >> Steven Cheng
| | >> Microsoft Online Support
| | >>
| | >> Get Secure! www.microsoft.com/security
| | >> (This posting is provided "AS IS", with no warranties, and confers
no
| | >> rights.)
| | >> --------------------
| | >> | From: <[email protected]>
| | >> | Subject: socket error
| | >> | Date: Thu, 10 Nov 2005 23:24:46 -0600
| | >> | Lines: 126
| | >> | X-Priority: 3
| | >> | X-MSMail-Priority: Normal
| | >> | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| | >> | X-RFC2646: Format=Flowed; Original
| | >> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| | >> | Message-ID: <#[email protected]>
| | >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | >> | NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| | >> | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| | >> | Xref: TK2MSFTNGXA02.phx.gbl
| | >> microsoft.public.dotnet.framework.aspnet:357281
| | >> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| | >> |
| | >> | Hi all,
| | >> |
| | >> | I have a simple .aspx page running on net 2.0 that is trying to
do
a
| | >> http
| | >> | post to a remote server. Here is the code
| | >> |
| | >> | Private Function ProcessRequests(ByVal strbody As String) As
String
| | >> |
| | >> | Dim returnstr As String
| | >> |
| | >> | Dim URL As String = "http://www.dydomain.com/test.asp"
| | >> |
| | >> | Dim h As HttpWebRequest = CType(WebRequest.Create(URL),
| HttpWebRequest)
| | >> |
| | >> | h.ContentType = "text/xml"
| | >> |
| | >> | h.Method = "POST"
| | >> |
| | >> | h.ContentLength = Len(strbody)
| | >> |
| | >> | h.KeepAlive = True
| | >> |
| | >> | h.Referer = "me"
| | >> |
| | >> | h.UserAgent = "me"
| | >> |
| | >> | Dim s As Stream = h.GetRequestStream()
| | >> |
| | >> | Dim sw As New StreamWriter(s)
| | >> |
| | >> | sw.Write(strbody)
| | >> |
| | >> | sw.Close()
| | >> |
| | >> | Dim hr As HttpWebResponse = CType(h.GetResponse, HttpWebResponse)
| | >> |
| | >> | Dim s2 As Stream = hr.GetResponseStream
| | >> |
| | >> | Dim sr As New StreamReader(s2)
| | >> |
| | >> | returnstr = sr.ReadToEnd
| | >> |
| | >> | sr.Close()
| | >> |
| | >> | h = Nothing
| | >> |
| | >> | hr.Close()
| | >> |
| | >> | hr = Nothing
| | >> |
| | >> | funcend:
| | >> |
| | >> | Return returnstr
| | >> |
| | >> | End Function
| | >> |
| | >> |
| | >> |
| | >> | I get an error on the following line:-
| | >> |
| | >> |
| | >> |
| | >> |
| | >> |
| | >> | Server Error in '/' Application.
| | >> |
| | >>
|
----------------------------------------------------------------------------
| | >> ----
| | >> |
| | >> | A socket operation encountered a dead network
| | >> | Description: An unhandled exception occurred during the execution
of
| | >> the
| | >> | current web request. Please review the stack trace for more
| information
| | >> | about the error and where it originated in the code.
| | >> |
| | >> | Exception Details: System.Net.Sockets.SocketException: A socket
| | >> operation
| | >> | encountered a dead network
| | >> |
| | >> | Source Error:
| | >> |
| | >> | Line 111: h.UserAgent = "me"
| | >> | Line 112:
| | >> | Line 113: Dim s As Stream = h.GetRequestStream()
| | >> | Line 114: Dim sw As New StreamWriter(s)
| | >> | Line 115: sw.Write(strbody)
| | >> |
| | >> | Source File: D:\Website Files\AppOne v2.0\appone
| | >> remoting\Default.aspx.vb
| | >> | Line: 113
| | >> |
| | >> | Stack Trace:
| | >> |
| | >> | [SocketException (0x2742): A socket operation encountered a dead
| | >> network]
| | >> | System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
| | >> | SocketAddress socketAddress) +1002146
| | >> | System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
+33
| | >> | System.Net.ServicePoint.ConnectSocketInternal(Boolean
| | >> connectFailure,
| | >> | Socket s4, Socket s6, Socket& socket, IPAddress& address,
| | >> ConnectSocketState
| | >> | state, IAsyncResult asyncResult, Int32 timeout, Exception&
| exception)
| | >> +431
| | >> |
| | >> | [WebException: Unable to connect to the remote server]
| | >> | System.Net.HttpWebRequest.GetRequestStream() +1504525
| | >> | _Default.ProcessRequests(Int32 lenderID, String strbody) in
| | >> D:\Website
| | >> | Files\AppOne v2.0\appone remoting\Default.aspx.vb:113
| | >> | _Default.CheckNADAProvider() in D:\Website Files\AppOne
| v2.0\appone
| | >> | remoting\Default.aspx.vb:97
| | >> | _Default.Page_Load(Object sender, EventArgs e) in D:\Website
| | >> Files\AppOne
| | >> | v2.0\appone remoting\Default.aspx.vb:15
| | >> | System.Web.UI.Control.OnLoad(EventArgs e) +99
| | >> | System.Web.UI.Control.LoadRecursive() +47
| | >> | System.Web.UI.Page.ProcessRequestMain(Boolean
| | >> | includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint)
| | >> +1061
| | >> |
| | >> |
| | >> |
| | >> |
| | >> |
| | >> |
| | >>
|
----------------------------------------------------------------------------
| | >> ----
| | >> |
| | >> | Version Information: Microsoft .NET Framework
Version:2.0.50727.42;
| | >> ASP.NET
| | >> | Version:2.0.50727.42
| | >> |
| | >> |
| | >> |
| | >> | This same code works on a .net 1.1 box on the same network. So I
know
| | >> | outbound access is OK. Any ideas? The box with the problems is
| running
| | >> | Server 2003 Enterprise SP1 w/ net 2.0 RTM.
| | >> |
| | >> | TIA!
| | >> |
| | >> |
| | >> |
| | >>
| | >
| | >
| |
| |
| |
|
|
 
S

Steven Cheng[MSFT]

Thanks for the followup.

Good luck!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: <[email protected]>
| References: <#[email protected]>
<q4h#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: socket error
| Date: Wed, 16 Nov 2005 12:17:01 -0600
| Lines: 350
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| Message-ID: <u1#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: corp2.lazardgroup.com 70.182.148.88
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:358653
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Yes it does. thanks
|
| | > Hi Param,
| >
| > Does the further infomation in my last reply helps? If anything else we
| > can
| > help, please feel free to post here.
| >
| > Regards,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | X-Tomcat-ID: 52205220
| > | References: <#[email protected]>
| > <q4h#[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain
| > | Content-Transfer-Encoding: 7bit
| > | From: (e-mail address removed) (Steven Cheng[MSFT])
| > | Organization: Microsoft
| > | Date: Mon, 14 Nov 2005 03:06:48 GMT
| > | Subject: Re: socket error
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | Lines: 222
| > | Path: TK2MSFTNGXA02.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:357811
| > | NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
| > |
| > | Hi Param,
| > |
| > | Thanks for your followup.
| > | I think the behavior you mentioned could be caused by the new
| > configuration
| > | of the
| > | <system.net><defaultProxy>.......
| > |
| > | in .net 2.0, which will use the IE setting if there is not default
proxy
| > | configured...
| > | In .net 1.1, there is default setting in machine.config which point
the
| > | default proxy setting is:
| > |
| > | <sytem.net>
| > | ...
| > | <defaultProxy>
| > | <proxy usesystemdefault="true"/>
| > | ..........
| > |
| > |
| > | while in .NET 2.0, this is not configured by default in the
| > machine.config.
| > | You can check the setting on your deve machine's machine.config.
Also,
| > | you can override this setting in your Application's application config
| > file
| > | /web.config file...
| > |
| > | Hope helps. Thanks,
| > |
| > | Steven Cheng
| > | Microsoft Online Support
| > |
| > | Get Secure! www.microsoft.com/security
| > | (This posting is provided "AS IS", with no warranties, and confers no
| > | rights.)
| > | --------------------
| > | | From: <[email protected]>
| > | | References: <#[email protected]>
| > | <q4h#[email protected]>
| > | <[email protected]>
| > | | Subject: Re: socket error
| > | | Date: Sat, 12 Nov 2005 14:20:45 -0600
| > | | Lines: 215
| > | | X-Priority: 3
| > | | X-MSMail-Priority: Normal
| > | | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| > | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| > | | X-RFC2646: Format=Flowed; Response
| > | | Message-ID: <[email protected]>
| > | | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | | NNTP-Posting-Host: corp2.lazardgroup.com 70.182.148.88
| > | | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| > | | Xref: TK2MSFTNGXA02.phx.gbl
| > | microsoft.public.dotnet.framework.aspnet:357660
| > | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | |
| > | | It ended up with something to do with our Proxy configuration. On
both
| > | the
| > | | 1.1 & 2.0 boxes I had the MS Firewall Client installed. This worked
| > fine
| > | on
| > | | the 1.1 box, but on the 2.0 box for some reason the httpwebrequest
| > | couldnt
| > | | get out. I un-installed the firewall client on the 2.0 box and it
| > ended
| > | up
| > | | working fine? Our proxy server (isa 2004) was configured to allow
all
| > | | outbound connections for both the boxes. So I dont see where the
| > problem
| > | | was?
| > | |
| > | | TIA!
| > | |
| > | | | > | | > Steve,
| > | | >
| > | | > 1. Yes I can visit that page directly through a browser on the
| > server.
| > | | > 2. The same code snippet works on another server on the same
network
| > | | > running net 1.1.
| > | | > 3. The vdir is running with anonymous authentication turned on.
It's
| > | | > application pool is configured to run under a normal user account
| > named
| > | | > "appone".
| > | | >
| > | | > I cant think of anything else?
| > | | >
message
| > | | > | > | | >> Hi Param,
| > | | >>
| > | | >> Welcome.
| > | | >> From your description, you're using HttpWebRequest component to
| > | | >> programmatically request an ASP page and encounter underlying
| > | connection
| > | | >> closed problem. From the code snippet you provided, seems there
| > | hasn't
| > | | >> any
| > | | >> particular things, I'd suggest you try the following things:
| > | | >>
| > | | >> 1. Whether you can visit that page correctly through browser
| > | | >> 2. Whether you can correctly request that page through the same
| > code
| > | in a
| > | | >> winform or console application.
| > | | >>
| > | | >> Also, if convenient, would you also provide the detailed
| > authentication
| > | | >> setting for that ASP page 's IIS virtual dir?
| > | | >>
| > | | >> Thanks,
| > | | >>
| > | | >> Steven Cheng
| > | | >> Microsoft Online Support
| > | | >>
| > | | >> Get Secure! www.microsoft.com/security
| > | | >> (This posting is provided "AS IS", with no warranties, and
confers
| > no
| > | | >> rights.)
| > | | >> --------------------
| > | | >> | From: <[email protected]>
| > | | >> | Subject: socket error
| > | | >> | Date: Thu, 10 Nov 2005 23:24:46 -0600
| > | | >> | Lines: 126
| > | | >> | X-Priority: 3
| > | | >> | X-MSMail-Priority: Normal
| > | | >> | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| > | | >> | X-RFC2646: Format=Flowed; Original
| > | | >> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| > | | >> | Message-ID: <#[email protected]>
| > | | >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | | >> | NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| > | | >> | Path:
| > TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | | >> | Xref: TK2MSFTNGXA02.phx.gbl
| > | | >> microsoft.public.dotnet.framework.aspnet:357281
| > | | >> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | | >> |
| > | | >> | Hi all,
| > | | >> |
| > | | >> | I have a simple .aspx page running on net 2.0 that is trying
to
| > do
| > a
| > | | >> http
| > | | >> | post to a remote server. Here is the code
| > | | >> |
| > | | >> | Private Function ProcessRequests(ByVal strbody As String) As
| > String
| > | | >> |
| > | | >> | Dim returnstr As String
| > | | >> |
| > | | >> | Dim URL As String = "http://www.dydomain.com/test.asp"
| > | | >> |
| > | | >> | Dim h As HttpWebRequest = CType(WebRequest.Create(URL),
| > | HttpWebRequest)
| > | | >> |
| > | | >> | h.ContentType = "text/xml"
| > | | >> |
| > | | >> | h.Method = "POST"
| > | | >> |
| > | | >> | h.ContentLength = Len(strbody)
| > | | >> |
| > | | >> | h.KeepAlive = True
| > | | >> |
| > | | >> | h.Referer = "me"
| > | | >> |
| > | | >> | h.UserAgent = "me"
| > | | >> |
| > | | >> | Dim s As Stream = h.GetRequestStream()
| > | | >> |
| > | | >> | Dim sw As New StreamWriter(s)
| > | | >> |
| > | | >> | sw.Write(strbody)
| > | | >> |
| > | | >> | sw.Close()
| > | | >> |
| > | | >> | Dim hr As HttpWebResponse = CType(h.GetResponse,
HttpWebResponse)
| > | | >> |
| > | | >> | Dim s2 As Stream = hr.GetResponseStream
| > | | >> |
| > | | >> | Dim sr As New StreamReader(s2)
| > | | >> |
| > | | >> | returnstr = sr.ReadToEnd
| > | | >> |
| > | | >> | sr.Close()
| > | | >> |
| > | | >> | h = Nothing
| > | | >> |
| > | | >> | hr.Close()
| > | | >> |
| > | | >> | hr = Nothing
| > | | >> |
| > | | >> | funcend:
| > | | >> |
| > | | >> | Return returnstr
| > | | >> |
| > | | >> | End Function
| > | | >> |
| > | | >> |
| > | | >> |
| > | | >> | I get an error on the following line:-
| > | | >> |
| > | | >> |
| > | | >> |
| > | | >> |
| > | | >> |
| > | | >> | Server Error in '/' Application.
| > | | >> |
| > | | >>
| > |
| >
----------------------------------------------------------------------------
| > | | >> ----
| > | | >> |
| > | | >> | A socket operation encountered a dead network
| > | | >> | Description: An unhandled exception occurred during the
execution
| > of
| > | | >> the
| > | | >> | current web request. Please review the stack trace for more
| > | information
| > | | >> | about the error and where it originated in the code.
| > | | >> |
| > | | >> | Exception Details: System.Net.Sockets.SocketException: A socket
| > | | >> operation
| > | | >> | encountered a dead network
| > | | >> |
| > | | >> | Source Error:
| > | | >> |
| > | | >> | Line 111: h.UserAgent = "me"
| > | | >> | Line 112:
| > | | >> | Line 113: Dim s As Stream = h.GetRequestStream()
| > | | >> | Line 114: Dim sw As New StreamWriter(s)
| > | | >> | Line 115: sw.Write(strbody)
| > | | >> |
| > | | >> | Source File: D:\Website Files\AppOne v2.0\appone
| > | | >> remoting\Default.aspx.vb
| > | | >> | Line: 113
| > | | >> |
| > | | >> | Stack Trace:
| > | | >> |
| > | | >> | [SocketException (0x2742): A socket operation encountered a
dead
| > | | >> network]
| > | | >> | System.Net.Sockets.Socket.DoConnect(EndPoint
endPointSnapshot,
| > | | >> | SocketAddress socketAddress) +1002146
| > | | >> | System.Net.Sockets.Socket.InternalConnect(EndPoint
remoteEP)
| > +33
| > | | >> | System.Net.ServicePoint.ConnectSocketInternal(Boolean
| > | | >> connectFailure,
| > | | >> | Socket s4, Socket s6, Socket& socket, IPAddress& address,
| > | | >> ConnectSocketState
| > | | >> | state, IAsyncResult asyncResult, Int32 timeout, Exception&
| > | exception)
| > | | >> +431
| > | | >> |
| > | | >> | [WebException: Unable to connect to the remote server]
| > | | >> | System.Net.HttpWebRequest.GetRequestStream() +1504525
| > | | >> | _Default.ProcessRequests(Int32 lenderID, String strbody) in
| > | | >> D:\Website
| > | | >> | Files\AppOne v2.0\appone remoting\Default.aspx.vb:113
| > | | >> | _Default.CheckNADAProvider() in D:\Website Files\AppOne
| > | v2.0\appone
| > | | >> | remoting\Default.aspx.vb:97
| > | | >> | _Default.Page_Load(Object sender, EventArgs e) in D:\Website
| > | | >> Files\AppOne
| > | | >> | v2.0\appone remoting\Default.aspx.vb:15
| > | | >> | System.Web.UI.Control.OnLoad(EventArgs e) +99
| > | | >> | System.Web.UI.Control.LoadRecursive() +47
| > | | >> | System.Web.UI.Page.ProcessRequestMain(Boolean
| > | | >> | includeStagesBeforeAsyncPoint, Boolean
| > includeStagesAfterAsyncPoint)
| > | | >> +1061
| > | | >> |
| > | | >> |
| > | | >> |
| > | | >> |
| > | | >> |
| > | | >> |
| > | | >>
| > |
| >
----------------------------------------------------------------------------
| > | | >> ----
| > | | >> |
| > | | >> | Version Information: Microsoft .NET Framework
| > Version:2.0.50727.42;
| > | | >> ASP.NET
| > | | >> | Version:2.0.50727.42
| > | | >> |
| > | | >> |
| > | | >> |
| > | | >> | This same code works on a .net 1.1 box on the same network. So
I
| > know
| > | | >> | outbound access is OK. Any ideas? The box with the problems is
| > | running
| > | | >> | Server 2003 Enterprise SP1 w/ net 2.0 RTM.
| > | | >> |
| > | | >> | TIA!
| > | | >> |
| > | | >> |
| > | | >> |
| > | | >>
| > | | >
| > | | >
| > | |
| > | |
| > | |
| > |
| > |
| >
|
|
|
 

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

Top