Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

WebApi configuration issue.

$
0
0

Hi All,

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 :

[RoutePrefix("api/MsmRating")]
    public class MsmRatingController : ApiController
    {
        [System.Web.Mvc.HttpGet]
        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.


Viewing all articles
Browse latest Browse all 4850

Trending Articles