简体   繁体   中英

Accept WCF request in WebAPI

I need to enable my webAPI REST service to accept a request in the format of:

www.someURL.com/OldService.svc

I am working on an existing application that used to use WCF. These methods do not have to return anything but a 200 response. 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.

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? 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("OldService.svc")]
    [HttpPost]        
    public HttpResponseMessage NewData(Data SomeData)
    {}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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