Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routes are not registering #279

Open
sakopov opened this issue Nov 25, 2013 · 1 comment
Open

Routes are not registering #279

sakopov opened this issue Nov 25, 2013 · 1 comment

Comments

@sakopov
Copy link

sakopov commented Nov 25, 2013

Trying to get routes to work with MVC 4.0.

Global.asax calls AttributeRouting to set things up:

        RouteTable.Routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
            });

Here is my controller action

    [Route("account/login", HttpVerbs.Get)]
    public ActionResult Index()
    {
        return View();
    }

When i run this Routes.axd shows 0 routes. The MapAttributeRoutes call is running but doesn't pick up any routes. The interesting thing is i can get routes to work in Web API project, but no dice with MVC.

EDIT:

Another weird thing is that i'm not able to pass any controller when mapping routes:

        routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromController<HomeController>();
            });

Will throw an exception stating that HomeController violates the constraint of type parameter 'T' or in another words doesn't implement IController which is bogus. It's really starting to sound like there are some compatibility issues with MVC 4.

@johnGeorge4
Copy link

Ever find a solution for this? I'm getting the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants