为什么不建议使用 MassTransit 在 Web 应用程序中托管接收端点?
Why is it not recommended to host receive endpoints in a web application using MassTransit?
我正在开发 ASP.NET MVC 5 应用程序(基于 nopCommerce)。我想使用 MassTransit 与另一个用于库存管理、计费等的应用程序通信。如果我可以将接收端点直接添加到 Web 应用程序中而不必为此创建 Windows 服务,那会更容易.但是 MassTransit documentation 表示不推荐,也没有解释为什么会这样。
MassTransit in a web application
Configuring a bus in a web site is typically done to publish events,
send commands, as well as engage in request/response conversations.
Hosting receive endpoints and persistent consumers is not recommended
(use a service as shown above).
有人知道背后的原因吗?在 Web 应用程序中添加接收端点不安全吗?它们会不能正常工作吗?
不建议在 Web 应用程序中托管端点,因为 Web 应用程序经常会因各种原因重新启动。这些原因通常不在应用程序本身的控制范围内。
虽然强烈建议使用独立的 Windows 服务,但只要使用 Application_Start
和 Application_End
方法正确启动和停止总线,就可以了没有其他可用的选项。
我正在开发 ASP.NET MVC 5 应用程序(基于 nopCommerce)。我想使用 MassTransit 与另一个用于库存管理、计费等的应用程序通信。如果我可以将接收端点直接添加到 Web 应用程序中而不必为此创建 Windows 服务,那会更容易.但是 MassTransit documentation 表示不推荐,也没有解释为什么会这样。
MassTransit in a web application
Configuring a bus in a web site is typically done to publish events, send commands, as well as engage in request/response conversations. Hosting receive endpoints and persistent consumers is not recommended (use a service as shown above).
有人知道背后的原因吗?在 Web 应用程序中添加接收端点不安全吗?它们会不能正常工作吗?
不建议在 Web 应用程序中托管端点,因为 Web 应用程序经常会因各种原因重新启动。这些原因通常不在应用程序本身的控制范围内。
虽然强烈建议使用独立的 Windows 服务,但只要使用 Application_Start
和 Application_End
方法正确启动和停止总线,就可以了没有其他可用的选项。