简体   繁体   English

可以在ASP.NET应用程序中启动的进程数量是否受到限制?

[英]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. 它们中的其余部分在启动后立即终止。

  • I tried the same thing in a Console Application, and all processes can be started and killed. 我在控制台应用程序中尝试了相同的操作,所有进程都可以启动和终止。
  • I tried to consume a lot of memory using another application and I could also keep 104 processes running. 我尝试使用另一个应用程序消耗大量内存,而且我还可以保持104个进程运行。
  • I tried to consume a lot of memory using another application and I could also keep 104 processes running. 我尝试使用另一个应用程序消耗大量内存,而且我还可以保持104个进程运行。
  • I also checked all possible IIS configuration and I could not find any settings which is related to this issue. 我还检查了所有可能的IIS配置,但找不到与此问题相关的任何设置。

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.

相关问题 使用登录次数限制保护ASP.NET应用程序的安全 - Secure an ASP.NET Application Using limit for number of logins 限制ASP.NET ListView上的结果数 - Limit the number of results on a ASP.NET ListView ASP.NET限制数量下载 - ASP.NET Limit number download 我可以在Docker容器中发布不是ASP.NET 5或ASP.NET Core的.Net应用程序吗? - Can I publish a .Net application which is not ASP.NET 5 or ASP.NET Core in Docker containers? 限制对Asp.Net应用程序的并发访问 - Limit concurrent access to Asp.Net application JavaScript minifyer,可以与ASP.NET应用程序的构建集成 - JavaScript minifyer which can be integrated with a build of an ASP.NET application 我如何开始将Winforms应用程序迁移到ASP.NET? - How can I get started with migrating my winforms application to ASP.NET? 如何知道哪个进程正在使用ASP.NET下的文件? - How to know which processes is using a file under ASP.NET? 有没有办法在 ASP.NET Web API 应用程序中全局限制并行任务的数量? - Is there a way to limit the number of parallel Tasks globally in an ASP.NET Web API application? 无法启动ASP.NET应用程序(未启动Localhost…) - Cannot start ASP.NET application (Localhost did not started…)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM