问题:底层连接已关闭:无法连接到远程服务器 [英] Problem: The underlying connection was closed: Unable to connectto the remote server

查看:416
本文介绍了问题:底层连接已关闭:无法连接到远程服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我正在开发一个C# - windows表单应用程序。为我的应用程序获取一些信息

,我正在连接到一个URL,它给了我使用php生成的XML



随着90%的用户,这段代码运行正常:

Hello,

I''m developing a C# - windows forms application. To get some information
for my application, I''m connecting to an URL, wich gives me XML
generated using php.
With 90% of the users, this code just works fine:

展开 | 选择 | Wrap | 行号

推荐答案

这当请求缺少像cookie这样的东西时会发生。

还有其他方法可以连接吗?如果是这样的话,请看看

ethereal什么是电线。这有时会提供所需的信息。


Kristof Thys <氪********** @ luc.ac.be>在消息中写道

news:d1 ********** @ ikaria.belnet.be ...
This can happen when the request lacks something like for example a cookie.
Are there other ways in which you can connect? If so, have a look with
ethereal what goes over the wire. That sometimes gives the required
information.

"Kristof Thys" <Kr**********@luc.ac.be> wrote in message
news:d1**********@ikaria.belnet.be...
你好,
我正在开发一个C# - Windows窗体应用程序。为了获得我的应用程序的一些信息,我正在连接到一个URL,它使用php生成了XML。
有90%的用户,这段代码运行正常:

Hello,

I''m developing a C# - windows forms application. To get some information
for my application, I''m connecting to an URL, wich gives me XML generated
using php.
With 90% of the users, this code just works fine:

展开 | 选择 < span class =codeDivider> | Wrap | 行号


Kristof,

您的代码没问题。这是您正在连接的URL,即

您的代码会抛出异常。我假设这是你的服务器

给你XML;如果是这样,那么我会确保服务器正常工作

并且它永远不会失去连接。


-
< ** @ dowhileloop.com中的href =mailto:in ** @ dowhileloop.com>
http://dowhileloop.com 网站开发
http:/ /publicjoe.dowhileloop.com - C#教程

" Kristof Thys" <氪********** @ luc.ac.be>在消息中写道

news:d1 ********** @ ikaria.belnet.be ...
Kristof,
Your code is fine. It''s the URL that you are connecting to that is making
your code throw an exception. I am assuming this is your server that is
giving you the XML; if so then I would make sure that the server is working
properly and that it''s never loosing connection.

--
in**@dowhileloop.com
http://dowhileloop.com website development
http://publicjoe.dowhileloop.com -- C# Tutorials
"Kristof Thys" <Kr**********@luc.ac.be> wrote in message
news:d1**********@ikaria.belnet.be...
你好,
我正在开发一个C# - Windows窗体应用程序。为了获得我的应用程序的一些信息,我正在连接到一个URL,它给了我使用php生成的XML。
有90%的用户,这段代码运行正常:

Hello,

I''m developing a C# - windows forms application. To get some information
for my application, I''m connecting to an URL, wich gives me XML
generated using php.
With 90% of the users, this code just works fine:

展开 | 选择 < span class =codeDivider> | Wrap | 行号


是的。

在编写这些类型的应用程序时,它很重要不要以为

URL可用。它也是一种很好的做法,也可以仔细检查XML的格式,但这不是这里发生的事情。

Yep.
When writing these types of apps its important to not presume that the
URL will be available. Its good practice to also double check the
formatting of the XML, but that''s not what''s happening here.


这篇关于问题:底层连接已关闭:无法连接到远程服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆