Problem with HttpWebResponse class

D

daz_oldham

Hi

I have a method (very bottom of this post) which I am using for doing
XMLRPC calls.

This works fine locally in Cassini (debug mode in VS2005, WinXP SP2),
however when I run this on my production server (MS Win 2k) I am
getting the following socket error:

System.Net.Sockets.SocketException: No connection could be made because
the target machine actively refused it (Stack trace below).

I have checked firewall settings etc. and it is 99.9% definately not
that - does anyone have any ideas what it could be? I was thinking
maybe the MSXML version so I have installed v6 in addition to v3 but it
has made no difference.

Many thanks in advance (and fingers crossed)

Darren


// STACK TRACE
[SocketException (0x274d): No connection could be made because the
target machine actively refused it]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
SocketAddress socketAddress) +1002130
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.GetResponse() +1501995
System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials
credentials) +61
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials) +1868384
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role,
Type ofObjectToReturn) +51
System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings
settings, XmlParserContext inputContext) +110
System.Xml.Schema.XmlSchemaSet.Add(String targetNamespace, String
schemaUri) +174
uc_fab_components_SelectCAR.PopulateDepartureAirports(String
sCountryCode, String sFABResortID) +173
uc_fab_components_SelectCAR.Page_Load(Object sender, EventArgs e)
+38
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1061



//METHOD
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sURL);
req.ContentType = "text/xml";
req.Method = "POST";
req.Timeout = 60000;

XmlDocument doc = new XmlDocument();

try
{
doc.LoadXml(xdRequest.InnerXml);
using (Stream post = req.GetRequestStream())
{
doc.Save(post);
}
HttpWebResponse resp =
(HttpWebResponse)req.GetResponse();
using (Stream fetched = resp.GetResponseStream())
{
doc.Load(fetched);
}
}
catch
{
// We need to build some error handing in here
XmlNode xnError = doc.CreateElement("Error");
xnError.Value = "-2002";
doc.AppendChild(xnError);

}
 
J

Joerg Jooss

Thus wrote daz_oldham,
Hi

I have a method (very bottom of this post) which I am using for doing
XMLRPC calls.

This works fine locally in Cassini (debug mode in VS2005, WinXP SP2),
however when I run this on my production server (MS Win 2k) I am
getting the following socket error:

System.Net.Sockets.SocketException: No connection could be made
because the target machine actively refused it (Stack trace below).

I have checked firewall settings etc. and it is 99.9% definately not
that - does anyone have any ideas what it could be? I was thinking
maybe the MSXML version so I have installed v6 in addition to v3 but
it has made no difference.

Many thanks in advance (and fingers crossed)

The answer is pretty simple: There's nobody listening on your destination
socket at "sURL" or your blocked by a firewall. You can try to connect using
telnet to that socket. Shouldn't work either.

Cheers,
 

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