2

我有一个在 ASP.NET 上运行并使用 SignalR 的 Web 应用程序,我支持客户端和服务器之间的实时通信。

我需要某种类型的工作进程,它在循环中工作,并根据需要使用 SignalR 连接通知客户端,并且 Web 应用程序必须能够调用工作进程。(工作进程和 Web 应用程序之间的双向通信

对于 web 应用程序和 worker 之间的通信,你会推荐什么?

一个场景是:

请求来自客户端 -> 我通知工作人员 -> 工作人员完成他的工作 -> 回调 Web 应用程序 -> 通知客户端。

或者

工作人员通知 -> Web 应用程序,使用 SignalR 通知 -> 客户端

我可以以某种方式共享实例吗?我可以在 IIS 内的同一应用程序域中运行此工作程序吗?我该如何处理?

谢谢 !

4

2 回答 2

1

You could use an asynchronous IIS-hosted WCF or Web Service where the request is initiated from the client and the response is handled in the request completion callback.

Since IIS could instantiate a separate instance of your service class, this class could call the appropriate worker directly since the user won't be directly waiting on the response.

于 2011-12-24T00:10:01.087 回答
1

通常我通过数据库在 ASP.NET 和另一个进程(在我的大多数情况下是计划的控制台应用程序)之间进行通信。

即,ASP.NET 应用程序将一些作业写入作业表,并且控制台应用程序(通过 Windows 任务计划程序每 10 分钟左右运行一次)从数据库表中提取作业并处理它们。

于 2011-12-23T22:14:10.303 回答