Routing and Content Directory

Mallioch's Avatar

Mallioch

19 Feb, 2011 07:21 AM

So a default MVC project comes with a Content directory. On my local box everything works fine. However, when I deploy I get the following error:

"The IControllerFactory 'HowMvcWorks.Infrastructure.Configuration.StructureMapControllerFactory' did not return a controller for the name 'Content'."

Now, I know that "StructureMapControllerFactory" is my own class. The problem isn't that. The problem is that it is trying to route the Content directory. I've tried e few variations of routes.IgnoreRoute("{Content}/{*pathInfo}"); in my global asax to get it to not route the content directory but it either gives me the same error or I get a 404. Any idea?

  1. Support Staff 1 Posted by tt on 19 Feb, 2011 08:08 AM

    tt's Avatar

    The issue is most likely that the files isn't part of the deployed website. You need to include the files in Visual Studio and in the property pane find the "Build Action" and select the "Content" option to ensure that the files will be copied.

    If you need to define a route to ignore, the proper syntax is "Content/{*pathInfo}", but you shouldn't need this unless the RouteExistingFiles property is enabled.

  2. tt closed this discussion on 19 Feb, 2011 08:08 AM.

  3. Mallioch re-opened this discussion on 19 Feb, 2011 02:27 PM

  4. 2 Posted by Mallioch on 19 Feb, 2011 02:27 PM

    Mallioch's Avatar

    But I am pushing the whole repository. Why would it need to be in the project file for it to be pushed/recognized. This isn't true in any other situations for resources like this.

  5. Support Staff 3 Posted by friism on 19 Feb, 2011 03:30 PM

    friism's Avatar

    The content of the output directory (which is what we deploy to the
    web servers) is generated by msbuild, and the content is decided not
    by what is in the repository, but what is in the project file.

    On 19/02/2011, at 06.27, "Eric Sowell"
    <[email blocked]>
    wrote:

  6. 4 Posted by Mallioch on 19 Feb, 2011 04:08 PM

    Mallioch's Avatar

    Well that makes sense. Thanks.

  7. friism closed this discussion on 19 Feb, 2011 04:27 PM.

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac