C#调试时提示 基础连接已关闭:连接被意外关闭

来源:百度知道 编辑:UC知道 时间:2024/05/24 19:55:28
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Web;
using System.Threading;
using WindowsApplication3;

namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void toolStripButton3_Click(object sender, EventArgs e)
{

Form2 frm = new Form2();
frm.Show();

}

private void button1_Click(object sender, EventArgs e)
{

string a = this.textBox3.Text.Trim();
int n = 0;
try
{
n = Convert.ToInt32(a) ;
this.textBox4.Text = n.ToString();

错误是发生在GetRemotPages.GetPage()方法内,检查GetRemotPages类.

textBox2.Text = GetRemotPages.GetPage(textBox1.Text, data, out err);

你可以这这么测试:
不用多线程单独call GetRemotPages.GetPage()方法,看有没有错误
还有,我想GetRemotPages.GetPage()方法内应该会传一个url网页地址之类的才有意义,否则,真看不懂GetPage()是做什么用

GetRemotPages.GetPage 你是向一个网址提交数据吧,你的错误信息说明,你访问的网址没有正确响应,可能是服务器挂了,也可能是网络问题

调试一下,获得你要访问的那个网址,然后手动输入到地址栏里,看看能不能打开。如果报错不能访问之类的错误,那说明你的网址有问题。