I have a widely distributed legacy web forms asp.net application with some WCF services exposed as webHttp endpoints. I'm in the process of reengineering the application to introduce functionality that is best implemented as MVC and web API controllers.
Since introducing MVC and web API to the application none of the webHTTP endpoints are accessible. For example Printing.svc implemented an interface with:
[ServiceContract]
public interface IPrinting
{
[WebGet(UriTemplate = "Printers")]
List<string> Printers(string profile);
}
I can successfully navigate to printing.svc and printing.svc/metadata, however, the printing.svc/help or printing.svc/Printers all return a 400 error (blank page). All the Web API and MVC routes work, and the wsdl for the soap bindings also work. Just not the "REST" WCF endpoints.
I have already added ignore values for the .svc routes:
routes.IgnoreRoute("{resource}.svc");
routes.IgnoreRoute("{resource}.svc/{*pathInfo}");
Still no dice. I have reproduced all this functionality in Web API, but would have liked to keep the old services active for legacy deployments.
So, can these two technologies coexist?
Are there any work arounds, or is it time to drop the "REST" WCF endpoints and move on?
EDIT
The solution: As suggested, I disabled routing in Web API and MVC, and ended up having to change from:
<endpointBehaviors>
<behavior name="restBehaviour">
<webHttp />
</behavior>
<behavior name="wsBehaviour" />
</endpointBehaviors>
to:
<endpointBehaviors>
<behavior name=""><!-- Added -->
<webHttp />
</behavior>
<behavior name="restBehaviour">
<webHttp />
</behavior>
<behavior name="wsBehaviour" />
</endpointBehaviors>
even though my service is:
<service name="K3.Reports.Web.Printing">
<endpoint address="" binding="webHttpBinding" contract="K3.Reports.Contracts.IPrinting" behaviorConfiguration="restBehaviour" />
</service>