1

I'm using Martin Deviller's tutorial to get MVC4's Web API working with Areas. I believe I've followed the instructions exactly, but GetControllerType throws the following exception when accessing "http://localhost/API/user":

Value cannot be null. Parameter name: controllerType

Does anyone have any ideas what could be causing this? This is what I've placed in my Area Registration file:

context.MapHttpRoute(
    name: "API_default",
    routeTemplate: "API/{controller}/{id}",
    defaults: new { id = RouteParameter.Optional }
);

Thanks in advance.

4

1 に答える 1

2

I see you are trying to access the route of the application without the area. Do you need areas or not?

If you are trying to follow the example then the Area registration would make the url "http://localhost/administration/API/user". Does this work?

    context.Routes.MapHttpRoute(
        name: "Administration_DefaultApi",
        routeTemplate: "Administration/api/{controller}/{id}",
        defaults: new { id = RouteParameter.Optional }
    );
于 2012-09-17T22:44:53.090 に答える