我有一个奇怪的实践"问题.对我们项目的体系结构的要求是使用WCF项目中的所有MVC优点(如果可能)设置Web API.这意味着WCF和Web API Web服务将在一个项目中彼此站在一起.
I have a little bit of a "strange practise" question. The requirement on an architecture of our project is to setup Web API with (if possible) all MVC goodness within WCF project. That means that WCF and Web API web services would be stood up along each other within one project.
这甚至可行吗?经过一小段时间,我发现即使合并两个项目的Web配置也非常困难.
Is this even doable? I've given it a short go and found that even merging the web configs of two projects is very hard.
感谢您的建议和评论,
雅各布
推荐答案可能但会丢失MVC优势(这意味着您将无法使用Web服务的内置自动在线文档)
It is possible but with losing the MVC goodness (that means that you will not be able to use for example the built in automatic online documentation for your web services).
只需通过NuGet安装Web API,然后在global.asax中注册您的路由.创建您的api控制器,一切都会很好.
Just install Web API through NuGet and then register your route in global.asax. Create your api controller and it should be all good.
编辑01.02.2017:
这不再成立.由于Microsoft的方法是合并MVC和Web API控制器.现在,任何事情都是可能的.
This is no longer true. Since Microsoft approach was to merge MVC and Web API controller. Now anything is possible.
更多推荐
在WCF项目中设置Web API
发布评论