简体   繁体   English

接受WebAPI中的WCF请求

[英]Accept WCF request in WebAPI

I need to enable my webAPI REST service to accept a request in the format of: 我需要启用我的webAPI REST服务以接受以下格式的请求:

www.someURL.com/OldService.svc

I am working on an existing application that used to use WCF. 我正在研究用于使用WCF的现有应用程序。 These methods do not have to return anything but a 200 response. 这些方法除了返回200响应外不必返回其他任何内容。 We need the REST service to handle this call so we can retire the old WCF service, but systems will fail if we don't support this WCF request. 我们需要REST服务来处理此调用,以便我们可以淘汰旧的WCF服务,但是如果我们不支持此WCF请求,系统将失败。

Has anybody done this before? 有人做过吗?

edit: 编辑:

Is it possible to do this with just adding a new route? 仅添加一条新路线就能做到吗?

您可以通过简单地添加一个New Item并选择Web将WCF服务(.svc)添加到Web API项目中,然后它将以WCF服务的形式显示在列表中。

Maybe you could use the Route attribute(using System.Web.Http) for the old service? 也许您可以将Route属性(使用System.Web.Http)用于旧服务? I've used this for route names like [Route("SomeRoute")] but I'm not 100% sure if the .svc extension will interfere with anything. 我已经将其用于[Route(“ SomeRoute”)]之类的路由名称,但是我不确定100.svc扩展名是否会干扰任何内容。

[Route("OldService.svc")]
    [HttpPost]        
    public HttpResponseMessage NewData(Data SomeData)
    {}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM