6

I just deployed my MVC app to a subdomain and I just can't get webapi to work.

Accessing locally: localhost:40052/api/apiEmpreendimento/GetObjects works just fine, but accessing the following online: http://subdomain.mysite.com/api/apiEmpreendimento/GetObjects

Gives me

{"Message":"No HTTP resource was found that matches the request URI 'http://subdomain.mysite.com/api/apiEmpreendimento/GetObjects'."}

App_Start/WebApiConfig.cs

public static class WebApiConfig
{
    public static void Register(HttpConfiguration config)
    {
        config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{action}/{id}",
            defaults: new { action = "get", id = RouteParameter.Optional }
        );
    }
}

Any tip is much appreciated.

Thanks

2
  • You realize your URL has api/api in it, right? Is that right? Commented Mar 15, 2013 at 2:05
  • i have the same configuration in my WebApiConfig and have methods name GetLocationCategory which accepts one parameter.. when i run the corresponding path , its giving me error :{"Message":"No HTTP resource was found that matches the request URI 'localhost:43433/api/WebApi/GetLocationCategory/87'. Commented Mar 30, 2013 at 6:20

1 Answer 1

2

I thought it's about new WepApi. MVC understands it like WebApi controller, Microsoft Reserved Api Controlller for their selves, I changed my Controller name With MyApiController and problem solved.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.