[英]Is there a limit on the number of processes, which can be started in an ASP.NET application?
I have a signalr server which is hosted in IIS. 我有一个托管在IIS中的信号器服务器。 There is a function in the hub which starts 600 processes in windows and then kills them.
集线器中有一个功能,可在Windows中启动600个进程,然后将其终止。
//start 600 processes
for (int i = 0; i < 600; i++)
{
try
{
Process myProcess = Process.Start(startInfo);
proclist.Add(myProcess);
Task.Delay(10).Wait();
}
catch(Exception e)
{
feedback = "Process " + i + " cannot be started: " + e.Message;
break;
}
feedback = "All processes are running.";
}
//kill them
foreach (var proc in proclist)
{
try
{
proc.Kill();
Task.Delay(10).Wait();
}
catch (Exception e)
{
feedback = "Process " + proclist.IndexOf(proc) + " cannot be killed: " + e.Message;
break;
}
feedback = "All Processes are killed.";
}
However, when I call this function in Client I get an Exception whiling killing the processes: 但是,当我在客户端中调用此函数时,出现异常,杀死进程:
Process 104 cannot be killed: Die Anforderung kann nicht verarbeitet werden, da der Prozess beendet wurde(The request cannot be proceeded, because the process is already terminated.) 进程104不能被杀死:Prozess bedet wurde报名(该进程已被终止,因此无法继续执行请求。)
It seems that I can only keep 104 processes runing. 看来我只能保持104个进程运行。 And the rest of them terminate immediately after start.
它们中的其余部分在启动后立即终止。
So I would like to ask whether anyone knows how to start more procecces in an ASP.NET application. 因此,我想问问是否有人知道如何在ASP.NET应用程序中启动更多过程。
I will appreciate it very much if someone can help me. 如果有人可以帮助我,我将非常感激。 Thanks!
谢谢!
I strongly suggest you do not execute 600 (or any multiple of hundred) processes under ASP.NET. 我强烈建议您不要在ASP.NET下执行600个(或数百个倍数)进程。 You will really strain the resources on the Aspnet_wp.exe process which could hurt the performance of the IIS box.
您确实会使Aspnet_wp.exe进程上的资源紧张,这可能会损害IIS框的性能。
You need to re-think the design. 您需要重新考虑设计。
If this was me, I would consider creating an external process outside of ASP.NET which could do the hard work for you. 如果是我,那么我将考虑在ASP.NET外部创建一个外部流程,该流程可以为您完成艰苦的工作。 For example, maybe you can create a Windows service (or even just a .NET console application running on the server) that waits (ie listens) on a file system folder for a file (you can name the file anything you like eg
start.txt
) to be created which you could do when a request to your website is made. 例如,也许您可以创建Windows服务(或什至只是服务器上运行的.NET控制台应用程序),该服务在文件系统文件夹中等待(即侦听)文件(您可以将文件命名为任意名称,例如
start.txt
),您可以在向网站提出请求时执行此操作。 That service will then execute the 600 exe files for you. 该服务将为您执行600 exe文件。
I'm not familiar with lasttest
, so my suggestion might not be adequate. 我对
lasttest
不熟悉,所以我的建议可能不够充分。 However, I do not believe you will achieve what you are looking for using your current design. 但是,我不相信您会使用当前的设计实现您想要的目标。 It's going to hurt performance, and in fact, I'm not suprised that a limit of running processes has been reached.
这将损害性能,实际上,我不惊讶已达到运行进程的限制。 I do not know of any documentation that points to how many exe files you can run in
Aspnet_wp.exe
, but that's likely because the ASP.NET team never expected anyone to attempt this. 我不知道有任何文档指出可以在
Aspnet_wp.exe
运行多少个exe文件,但这很可能是因为ASP.NET团队从未期望有人尝试过此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.