By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 971 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

socket error

P: n/a
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(Bool ean 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!
Nov 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
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: <pa***@community.nospam>
| 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: <#U**************@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.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(Bool ean 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!
|
|
|

Nov 19 '05 #2

P: n/a
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[MSFT]" <st*****@online.microsoft.com> wrote in message
news:q4****************@TK2MSFTNGXA02.phx.gbl...
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: <pa***@community.nospam>
| 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: <#U**************@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.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(Bool ean 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!
|
|
|

Nov 19 '05 #3

P: n/a
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!

<pa***@community.nospam> wrote in message
news:Oe*************@TK2MSFTNGP11.phx.gbl...
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[MSFT]" <st*****@online.microsoft.com> wrote in message
news:q4****************@TK2MSFTNGXA02.phx.gbl...
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: <pa***@community.nospam>
| 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: <#U**************@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.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(Bool ean
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!
|
|
|


Nov 19 '05 #4

P: n/a
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: <pa***@community.nospam>
| References: <#U**************@TK2MSFTNGP12.phx.gbl>
<q4**************@TK2MSFTNGXA02.phx.gbl>
<Oe*************@TK2MSFTNGP11.phx.gbl>
| 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: <ui**************@TK2MSFTNGP14.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: corp2.lazardgroup.com 70.182.148.88
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.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!
|
| <pa***@community.nospam> wrote in message
| news:Oe*************@TK2MSFTNGP11.phx.gbl...
| > 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[MSFT]" <st*****@online.microsoft.com> wrote in message
| > news:q4****************@TK2MSFTNGXA02.phx.gbl...
| >> 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: <pa***@community.nospam>
| >> | 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: <#U**************@TK2MSFTNGP12.phx.gbl>
| >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
| >> | NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| >> | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.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(Bool ean
| >> 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!
| >> |
| >> |
| >> |
| >>
| >
| >
|
|
|

Nov 19 '05 #5

P: n/a
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: <#U**************@TK2MSFTNGP12.phx.gbl>
<q4**************@TK2MSFTNGXA02.phx.gbl>
<Oe*************@TK2MSFTNGP11.phx.gbl>
<ui**************@TK2MSFTNGP14.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online.microsoft.com (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: <Pg**************@TK2MSFTNGXA02.phx.gbl>
| 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: <pa***@community.nospam>
| | References: <#U**************@TK2MSFTNGP12.phx.gbl>
| <q4**************@TK2MSFTNGXA02.phx.gbl>
| <Oe*************@TK2MSFTNGP11.phx.gbl>
| | 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: <ui**************@TK2MSFTNGP14.phx.gbl>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | NNTP-Posting-Host: corp2.lazardgroup.com 70.182.148.88
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.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!
| |
| | <pa***@community.nospam> wrote in message
| | news:Oe*************@TK2MSFTNGP11.phx.gbl...
| | > 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[MSFT]" <st*****@online.microsoft.com> wrote in message
| | > news:q4****************@TK2MSFTNGXA02.phx.gbl...
| | >> 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: <pa***@community.nospam>
| | >> | 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: <#U**************@TK2MSFTNGP12.phx.gbl>
| | >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | >> | NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| | >> | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.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(Bool ean
| | >> 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!
| | >> |
| | >> |
| | >> |
| | >>
| | >
| | >
| |
| |
| |
|
|

Nov 20 '05 #6

P: n/a
Yes it does. thanks

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:Rs**************@TK2MSFTNGXA02.phx.gbl...
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: <#U**************@TK2MSFTNGP12.phx.gbl>
<q4**************@TK2MSFTNGXA02.phx.gbl>
<Oe*************@TK2MSFTNGP11.phx.gbl>
<ui**************@TK2MSFTNGP14.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online.microsoft.com (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: <Pg**************@TK2MSFTNGXA02.phx.gbl>
| 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: <pa***@community.nospam>
| | References: <#U**************@TK2MSFTNGP12.phx.gbl>
| <q4**************@TK2MSFTNGXA02.phx.gbl>
| <Oe*************@TK2MSFTNGP11.phx.gbl>
| | 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: <ui**************@TK2MSFTNGP14.phx.gbl>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | NNTP-Posting-Host: corp2.lazardgroup.com 70.182.148.88
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.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!
| |
| | <pa***@community.nospam> wrote in message
| | news:Oe*************@TK2MSFTNGP11.phx.gbl...
| | > 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[MSFT]" <st*****@online.microsoft.com> wrote in message
| | > news:q4****************@TK2MSFTNGXA02.phx.gbl...
| | >> 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: <pa***@community.nospam>
| | >> | 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: <#U**************@TK2MSFTNGP12.phx.gbl>
| | >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | >> | NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| | >> | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.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(Bool ean
| | >> 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!
| | >> |
| | >> |
| | >> |
| | >>
| | >
| | >
| |
| |
| |
|
|

Nov 20 '05 #7

P: n/a
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: <pa***@community.nospam>
| References: <#U**************@TK2MSFTNGP12.phx.gbl>
<q4**************@TK2MSFTNGXA02.phx.gbl>
<Oe*************@TK2MSFTNGP11.phx.gbl>
<ui**************@TK2MSFTNGP14.phx.gbl>
<Pg**************@TK2MSFTNGXA02.phx.gbl>
<Rs**************@TK2MSFTNGXA02.phx.gbl>
| 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**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: corp2.lazardgroup.com 70.182.148.88
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:358653
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Yes it does. thanks
|
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:Rs**************@TK2MSFTNGXA02.phx.gbl...
| > 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: <#U**************@TK2MSFTNGP12.phx.gbl>
| > <q4**************@TK2MSFTNGXA02.phx.gbl>
| > <Oe*************@TK2MSFTNGP11.phx.gbl>
| > <ui**************@TK2MSFTNGP14.phx.gbl>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain
| > | Content-Transfer-Encoding: 7bit
| > | From: st*****@online.microsoft.com (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: <Pg**************@TK2MSFTNGXA02.phx.gbl>
| > | 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: <pa***@community.nospam>
| > | | References: <#U**************@TK2MSFTNGP12.phx.gbl>
| > | <q4**************@TK2MSFTNGXA02.phx.gbl>
| > | <Oe*************@TK2MSFTNGP11.phx.gbl>
| > | | 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: <ui**************@TK2MSFTNGP14.phx.gbl>
| > | | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | | NNTP-Posting-Host: corp2.lazardgroup.com 70.182.148.88
| > | | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.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!
| > | |
| > | | <pa***@community.nospam> wrote in message
| > | | news:Oe*************@TK2MSFTNGP11.phx.gbl...
| > | | > 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[MSFT]" <st*****@online.microsoft.com> wrote in
message
| > | | > news:q4****************@TK2MSFTNGXA02.phx.gbl...
| > | | >> 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: <pa***@community.nospam>
| > | | >> | 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: <#U**************@TK2MSFTNGP12.phx.gbl>
| > | | >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | | >> | NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| > | | >> | Path:
| > TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.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(Bool ean
| > | | >> 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!
| > | | >> |
| > | | >> |
| > | | >> |
| > | | >>
| > | | >
| > | | >
| > | |
| > | |
| > | |
| > |
| > |
| >
|
|
|

Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.