Last post Dec 01, 2015 03:38 PM by Chris Zhao
Nov 30, 2015 04:55 PM|billcrawley|LINK
We have a class library project with as you'd expect a bunch of classes with methods. One of the classes I have set it to inherit from the ApiController class. For now I have made a simple method in the class :
public class MsmRatingController : ApiController
public string GetProductCode()
return SubProductProductCode.GetProductCode(1, 2);
Although you can see that I'm referencing the Mvc namespace, this isn't a true website, so there's no global.asax, or routing config files. It's a dll that I have compiled.
I then create a new website in IIS and I point it to the Bin directory where the DLL resides.
Then back in another method in another application (just happens to be a WCF application) I attempt to do the following:
var request = (HttpWebRequest)WebRequest.Create("http://localhost:8060/api/MsmRating/GetProductCode");
request.Method = "GET";
var webResponse = request.GetResponse();
I always get a 404 error not found. can anybody see what's wrong here.
Nov 30, 2015 05:34 PM|Sumit.Pokhriyal|LINK
Based on the description provided you want your service (web API) to be self hosted not on IIS.
User the below link for details on doing that:
Dec 01, 2015 03:38 PM|Chris Zhao|LINK
Web API configuration setttings are defined in the HttpConfiguration class.
In an ASP.NET application, configure Web API by calling GlobalConfiguration.Configure in the Application_Start method.
The Configure method takes a delegate with a single parameter of type HttpConfiguration.
You could refer to
Configuring ASP.NET Web API 2.