0

我刚刚被要求协助进行以下娱乐活动。

今天的状态

一个网站在info.com上运行,是一些数据的查看器(带有基本的编辑器)。检索和存储操作是通过调用另一个网站data.com来完成的。

查看器是使用 Web 表单创建的。Web 服务可能是 WCF(但可能更旧)。

国家针对

  1. 该体系结构已移至 Azure。
  2. 查看器被重写为 MVC。
  3. Web 服务确保为 WCF。
  4. 这两个部分都在同一个网站下运行。

问题

(1) 已经完成。(2) och (3) 对我来说不是问题。但是,我对(4)有点不确定。我担心在同一个 Azure 网站下部署 MVC 项目和 WCF 项目时可能会出现一些问题。

我应该预料到什么问题?我会后悔没有采取哪些预防措施?

4

1 回答 1

1

When you say you want to run both parts under the same website, do you mean the same web role, or the same actual web site?

If you mean the same web role, but different sites you can do that using the multiple site hosting capability of the web roles in Cloud Services. You can read MSDN Documentation on Configure a Web Role for Multiple Web Sites. Note that this path will be much more like the original scenario in that these are two distinct web sites and could be broken apart easily later. If you look into this I would highly recommend reading Tips for Publishing Multiple Sites in a Web Role by Michael Collier. There are some oddities in how the additional sites get packaged that you'll need to know.

If you mean in the same actual web site then that's really just straight forward. There is no real Windows Azure specific things to deal with here. Just add WCF endpoints (svc) to your MVC web project. I tested this out by creating a MVC 4 app. I added a top level folder called Api. Then I did a Add New Item on the Api folder and chose WCF Service from the dialog. It added the .svc file, interface, etc. You can even break the implementation of the service out to another assembly if you'd like. Depending on where you decide to place your service endpoints within your project you may need to deal with the routing, or you may not.

Other options to look at are non WCF specific, like using WebAPI within the same MVC project or even just using MVC controllers more like a service endpoint that return data and not a view.

于 2013-08-31T13:15:37.143 回答