Question

I have to replicate a MVC4 WebAPI application but mine will just echo the data being sent to it, so I'm wondering if I should just go with a simpler WCF service, because MVC4 WebAPI application has lots of files. The exposed API is very simple:

public Task<HttpResponseMessage> PostData(HttpRequestMessage requestMessage)

I have three questions:

  1. Is it possible to get rid of all the extra .js and other files from MVC4 WebAPI, since I only need to expose an API and don't need any views?
  2. If I were to port this to WCF, what would the signature look like?

    [OperationContract] HttpResponseMessage PostData(HttpRequestMessage request)

  3. Is it worth writing the echo service in WCF?

Was it helpful?

Solution

Don't use WCF for this... and I happen to have liked WCF in its time so this is not a hater telling you this.

If you have a lot of files in your MVC4 WebAPI project I'm not sure what went wrong. You don't need any /Content or /Views at all. You pretty much just need the /Controllers/MyController.cs file itself and something mapping you a route to it which should be in the default /App_Start/WebApiConfig.cs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top