如何将访问 Web 应用程序的每个用户与服务分配的单独的临时进程关联起来?

发布于 2024-09-12 03:40:15 字数 741 浏览 4 评论 0原文

我想使用在 IIS 上运行的 ASP.NET 开发一个 Web 应用程序。

如果用户提交 MAXIMA 输入命令,后面的代码将要求自定义 Windows 服务创建一个新的不同临时进程来执行外部程序集。

更准确地说,只有一个 Windows 服务为所有用户提供服务,但每个用户都将与一个运行外部程序集的不同的临时进程相关联。

Windows 服务包含侦听某个端口的单个套接字和用于通信的异步套接字列表。列表中的每个套接字都将与运行外部程序集的不同临时进程通信,该程序集充当客户端套接字。

请注意:我使用进程而不是应用程序域,因为外部程序集是批处理文件(不是托管程序集)。

我的问题是:

  1. 如何从代码隐藏调用Windows服务?
  2. 如何将每个用户与一个独特的临时进程相关联?
  3. 如果同时工作的用户越来越多,如何提高可扩展性?
  4. 如果用户输入的 Maxima 输入命令导致进程长时间运行,通知用户进度的明智方法是什么?

以下链接为您提供有关我的项目的更多详细信息: https:// sourceforge.net/projects/aspmaxima/forums/forum/1190702/topic/3786806

提前谢谢您。

I want to develop a web application using ASP.NET running on IIS.

If a user submits a MAXIMA input command, the code behind will ask a custom windows service to create a new distinct temporary process executing an external assembly.

More precisely, there is only one windows service serving for all users, but each user will be associated with a distinct, temporary process running an external assembly.

The windows service contains a single socket listening on a certain port and a list of asynchronous sockets for communication. Each socket of the list will communicate with a distinct, temporary process running an external assembly which works as a client socket.

Note that: I use a process rather than an application domain because the external assembly is a batch file (not managed assembly).

My questions are:

  1. How to call windows service from code behind?
  2. How to associate each user with a distinct, temporary process?
  3. How to improve scalability if there are more and more users working simultaneously?
  4. If the Maxima input command entered by a user cause long-running process, what is the wise way to notify the user about the progress?

The following link provide you with more detail about my project: https://sourceforge.net/projects/aspmaxima/forums/forum/1190702/topic/3786806

Thank you in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神经暖 2024-09-19 03:40:16

您不应该在 MVC 应用程序中使用代码隐藏。

与非托管代码互操作时的可扩展性很困难。唯一明智的方法是分解问题。

  • 当您启动非托管应用程序时,它已经有了自己的进程。
  • 从 Web 应用程序调用的服务中的多个任务流,并进行监控?您正在描述 Windows Server AppFabric。使用 AppFabric 托管您的服务,您无需自己编写所有这些内容。
  • 关于可扩展性,当您处理非托管进程时,您将必须限制可以同时启动的数量。需要反复试验才能确定特定硬件上的最佳方案。
  • 仅当该应用程序专门提供时,您才能监控非托管任务的进度。
  • 从服务启动任意非托管代码是危险的,因为默认情况下启动的应用程序会继承服务的(通常是提升的)权限。考虑为启动的应用程序使用特定的、有限的凭据,而不是默认凭据。

You should not be using codebehind in an MVC app.

Scalability while interoprating with unmanaged code is hard. The only sane way to do this is to decompose the problem.

  • When you launch an unmanaged app, it already has its own process.
  • Multiple task flows in a service called from a web app, with monitoring? You're describing Windows Server AppFabric. Host your service with AppFabric, and you won't have to write all of this yourself.
  • Regarding scalability, when you're dealing with unmanaged processes, you're going to have to limit the number which can start concurrently. Trial and error will be necessary to determine the optimum on specific hardware.
  • You can only monitor an unmanaged task's progress if that app specifically provides for it.
  • Launching arbitrary unmanaged code from a service is dangerous, because the launched app, by default, inherits the service's (typically raised) permissions. Consider using specific, limited credentials for the launched app instead of the default.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文