{"The controller for path 'main_bg.gif' was not found or does not implement IController."}
Of course, /Content/images/main_bg.gif won't be in YOUR error message, but some image you are using will likely be in your message. As you can see, StructureMap seems to be looking for a controller for the path of one of my image files. Well isn't that great? Now what? Fear not my friends, the solution to this problem is very, very simple - I promise. Before I tell you the answer, I'm going to ask you a question. What area can you use in MVC to tell your program to ignore or follow certain paths? .........1..........2.........3........Give up? It is the RegisterRoutes area of the global.asax. In this case, you just need to tell your code to ignore the route to your beautiful graphic and StructureMap will stop giving you the error. See, I told you it was simple!
Smooches,
Kila
Problem:
You are receiving the following error when you are debugging your ASP.NET MVC application in Visual Studio.
{"The controller for path 'main_bg.gif' was not found or does not implement IController."}
(You might also see something like the following:
{"The controller for path '/' was not found or does not implement IController."})
Solution:
Change your global.asax RegisterRoutes routine to ignore the offending path.
Example: routes.IgnoreRoute("{*ignoregifs}", new { ignoregifs = @".*\.gif(/.*)?" }); This will ignore all gifs.
If your issue is some other type of file or "/", you simply adjust the regular expression accordingly.
1 comment:
Interesting read.
Post a Comment