em70
em70

Reputation: 6081

ASP.NET MVC 1.0 - Error 404

A colleague of mine replaced by mistake a web.config file which we don't have in our back-ups and now an old MVC 1.0 site which we're running off IIS6 is showing 404 errors instead of the pages.

The current web.config looks like this:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <httpHandlers>
      <add path="*" verb="*"
          type="System.Web.HttpNotFoundHandler"/>
    </httpHandlers>
    <!--
        Enabling request validation in view pages would cause validation to occur
        after the input has already been processed by the controller. By default
        MVC performs request validation before a controller processes the input.
        To change this behavior apply the ValidateInputAttribute to a
        controller or action.
    -->
    <pages
        validateRequest="false"
        pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <controls>
        <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
      </controls>
    </pages>
  </system.web>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
      <remove name="BlockViewHandler"/>
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
    </handlers>
  </system.webServer>
</configuration>

And there is a global.asax file that helps mapping routes to the appropriate .aspx pages (this hasn't been touched and was fully functional up to 1h ago).

Any idea on how to fix this?

Edit: I should also specify that the web.config under /Views was replaced as well with a web.config that's identical to the one in the root. Finally, let me add that the site is in shared hosting.

Upvotes: 0

Views: 256

Answers (1)

mgnoonan
mgnoonan

Reputation: 7200

I think your best bet might be to create a new, blank MVC 1.0 site in VS, copy over any appSettings and connectionStrings, and then do a comparison to see what any remaining differences are. It's been a while since I looked at MVC 1, but the config you list looks ok to me. You can also see what the web.config in the Views folder should look like, as it's unlikely you would have changed that one.

Also, if you are getting 404s, you should make sure your wildcard mapping in IIS6 is still set.

Upvotes: 1

Related Questions