ASP.Net的Web API和WCF - 可以在Web API一起使用,以提供一个单身WCF服务基于REST的沟通?

问题描述:

我有一个现有的一套单身WCF服务。他们是长期运行的流程,与其他进程通信做一个持续的基础上做了大量的工作,揭露自己与WCF服务合同。

I have an existing set of singleton WCF services. They are long-running processes that do a lot of work on an ongoing basis and expose themselves with WCF service contracts for communication with other processes.

当WCF的Web API正在开发我很兴奋,因为它看起来像我终于能够与所有的恼人的合约东西做路程,只需为每个服务提供一个平台无关的REST API,并有流程通过HTTP请求和JSON响应通信。

When the WCF Web API was being developed I was excited because it was looking like I'd finally be able to do away with all of the annoying contract stuff and simply provide a platform-agnostic REST API for each service and have the processes communicate via HTTP requests and JSON responses.

现在它看起来像在Web API已经成为一个IIS托管的ASP.Net功能,留下我试图找出如果我只是失去了一些东西,或者我的WCF服务将不再有机会提供了一个REST接口

Now it looks like the Web API has become an IIS-hosted ASP.Net feature, leaving me trying to figure out if I'm just missing something or if my WCF services will no longer have the opportunity to provide a REST interface.

如果在Web API不再是真正针对我的情况下,有什么有ASP.Net团队对于非终止单流程设想,希望提供一个HTTP / JSON-基于API给其他消费过程?

If the Web API is no longer really targeted at my scenario, what has the ASP.Net team envisioned with respect to non-terminating singleton processes that wish to provide an HTTP/JSON-based API to other consuming processes?

您不必在IIS中承载的ASP.NET Web API服务。有一个称为自我选项托管一>,让您的主机在另一个进程的API服务(如Windows服务),如果你想。我想,你目前的架构会工作得很好作为自托管应用程序。

You do not have to host ASP.NET Web API services in IIS. There is an option called "Self Hosting" that will allow you to host your API services in another process (such as a Windows Service) if you would like. I imagine that your current architecture would work just fine as a self-hosted app.