读书人

多线程调用webService泄漏移除掉app

发布时间: 2012-03-26 15:46:56 作者: rapoo

多线程调用webService泄漏,移除掉app.config 就没有问题 求大侠们看看 是否是.net的bug
//调用者代码
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
int i=0;

//使用线程测试
int i=0;
Service1 client=new Service1();
for (i=0;i <10000;i++)
{
Test t = new Test();
t.count = i;
t.client=client;

Thread osThread = null;
osThread = new Thread(new ThreadStart(t.Run));
osThread.Start();
Thread.Sleep(1000);
}
Console.ReadLine();
}
public class Test
{
public Test()
{

}
public int count;
public Service1 client=null;
public void Run()
{
Console.WriteLine( "执行{0}次 ",count.ToString());
//Service1 client=new Service1();
Console.WriteLine(client.HelloWorld());
return ;

}
}


//webservice代码 就是简单的helloword
[WebMethod]
public string HelloWorld()
{
return "Hello World ";
}

改为线程池句柄也不断增长,这个问题发现很就了,一直没有找到原因。我的 MSN
tangyiping0@hotmail.com
有兴趣的朋友请加我,我直接把测试代码传过去。

[解决办法]
帮顶,可能还是代码问题
[解决办法]
先mark
[解决办法]
app.config里面写了些啥?
[解决办法]
学习中~
[解决办法]
都是很好的建议! 值得学习

读书人网 >Web Service

热点推荐