首页 文章

在Azure中的同一个Cloud Service中托管MVC前端和WebAPI后端

提问于
浏览
1

我有一个MVC前端应用程序(相对较小),它有自己的DAL实现,使用存储库模式 . 我正在考虑在自己的WebAPI项目中移动DAL以保持更清晰的分离 . MVC应用程序使用 Cloud 服务(Web角色)托管在Azure中 . WebAPI将仅由前端应用程序使用,暂时不会暴露给任何其他外部应用程序,但即便如此,我仍然希望将其作为单独的应用程序/ Web /辅助角色托管,而不是将DAL保留在同一个项目 .

以下是一个好主意:

1)将WebAPI项目作为Web / Worker角色托管在同一个Cloud Service中,还是应该创建一个新的网站/ Cloud 服务来托管它?使用相同的 Cloud 服务是首选,记住成本因素和n / w延迟问题 .

2)如果我托管在同一个 Cloud 服务中,那么更适合用于web api项目 - web或worker角色?

3)在某处我读到我应该使用Azure中的Service Bus来进行MVC前端和WebAPI后端之间的交互 . 这是建议的做法吗?还是有更简单的方法来完成它?

1 回答

  • 0

    I would suggest you to use the same cloud service. The reason being complexity and failure scenarios, when you split your app into multiple cloud services the problem comes when you are updating them service from your source control

    您需要进行两次部署并确保它们处于同步状态等 .

    我会在一个 Cloud 服务中简化服务运行时 .

    如果你真的想在代码级别将它们分开并且知道它们可以正常工作,那么它又是首选和舒适 . 两个 Cloud 服务应该没问题 .

    From experience, refactoring decision like these add a lot of work in the future. Positive or negative depends on your understand of the problem and the image of the bigger picture you have in your head that cannot be put on paper :).

    Happy to Help, Yours Truly -CB

相关问题