开发者

C# Cannot load XML document from server

开发者 https://www.devze.com 2023-03-06 09:59 出处:网络
I had an XMLDocument loading a document from a server with no problems till, almost randomly, I started getting a connection refused error.

I had an XMLDocument loading a document from a server with no problems till, almost randomly, I started getting a connection refused error.

It also doesn't matter what host I put in, whether it's a legit one or unresolvable. It always gives the same result.

Here's the code:

    XmlDocument doc = new XmlDocument();
    doc.Load("http://doesnotmatterifIresolveornot.com");

And here is the error:

{"No connect开发者_JS百科ion could be made because the target machine actively refused it 127.0.0.1:8888"}

I've turned off any applicable firewalls I can find in Win7, but it's weird cause it happened while I was testing it.


Find out why it's trying to go to 127.0.0.1:8888.

My guess is that for some reason, it thinks that's your HTTP proxy. Did you run something like Fiddler recently? Fiddler runs on 8888 and changes your default proxy settings - maybe they got stuck incorrectly?

Look in Control Panel, or in the Internet Explorer settings.


Are you serving your XML document using IIS? If so, you may need to add a mime-type definition to IIS to serve XML files. This article should help with that (if it is indeed the problem).

you may also try the HTTP loader to get a more detailed picture of what the server is responding with (HTTP headers, in particular, could be useful for troubleshooting).

I suspect the primary issue is that you're trying to connect to a socket (server + port) that the server isn't configured to listen on -- that means you'll get this error regardless of whether or not the URL resolves, since the server isn't configured to deal with a socket connection of the sort you're sending it.

0

精彩评论

暂无评论...
验证码 换一张
取 消