当前位置: 代码迷 >> Web Service >> 多线程调用webService泄漏,移除掉app.config 就没有有关问题 求大侠们看看 是否是.net的bug
  详细解决方案

多线程调用webService泄漏,移除掉app.config 就没有有关问题 求大侠们看看 是否是.net的bug

热度:304   发布时间:2016-05-02 03:02:26.0
多线程调用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  
[email protected]  
有兴趣的朋友请加我,我直接把测试代码传过去。

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