StructureMap controller factory and null controller instance in MVC

前端 未结 4 1038
不知归路
不知归路 2021-02-08 10:38

I\'m still trying to figure things out with StructureMap and one of the issues i\'m running into is my Controller Factory class blowing up when a null controller type is passed

4条回答
  •  忘了有多久
    2021-02-08 11:06

    I ran into the same problem with a controller factory built around ninject.

    It seems MVC will pass you null for controllertype when it can't resolve a route from the routing table or when a route specifies a none existing controller. I did two things to solve this. You might want to check your route table and add a catchall route that shows a 404 error page like described here .Net MVC Routing Catchall not working

    You could also check with the routing debugger what goes wrong. http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx

提交回复
热议问题