Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法在IIS7中开始线程_C#_Multithreading_Iis 7 - Fatal编程技术网

C# 无法在IIS7中开始线程

C# 无法在IIS7中开始线程,c#,multithreading,iis-7,C#,Multithreading,Iis 7,我正在VisualStudio2010中运行并执行以下代码 Thread thrd = new Thread(new ThreadStart( delegate { Init(visible); System.Windows.Forms.Application.Run(this); })); thrd.Set

我正在VisualStudio2010中运行并执行以下代码

Thread thrd = new Thread(new ThreadStart(
                delegate {
                    Init(visible);
                    System.Windows.Forms.Application.Run(this);                
                }));
       thrd.SetApartmentState(ApartmentState.STA);
       thrd.Start();
此线程成功执行,调用“Init”函数以启动新的webbrowser

但是,当我在IIS7中使用ASP.NET 4.0应用程序池配置网站时,线程中的任何内容都不会执行。可以给我一些指导吗,需要做哪些设置

问候,, 阿尼尔

更新: 这是代码的链接:


而且似乎我不是唯一一个出现此问题的人。

您不能在IIS中启动Windows应用程序。你想做什么?我想你已经有了第三个开始;在你的代码中的某个地方。你是如何准确地确定放在线程中的任何东西都不会被执行的?例如,与执行但失败相反,我只是在线程的内部和外部放置一个System.Windows.Forms.MessageBox。当它在线程之外时,页面抛出一个错误,说它无法打开服务器端的messagebox,这实际上是正确的,当它在线程中时,什么都没有发生,没有错误,也没有messagebox。对,所以它很可能确实执行了并且失败了。它没有报告它也失败了。如果你在线程中放置了一个不会失败的操作,你很可能会看到它正在被执行。@DavidSchwartz也许,你说的是真的,但我仍然不明白,为什么它在Visual Studio调试模式下工作得很好,但在IIS7中却不能。