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).

Alguna idea de como arreglar esto?

Editar: 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.

preguntado el 31 de julio de 12 a las 12:07

1 Respuestas

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.

Respondido 31 Jul 12, 13:07

Searching relentlessly I found that the web.config in place seems to belong only to the ~/Views path, and from what I could gather there's a lot more that's supposed to go on there. Unfortunately I don't have any environment where I could create an MVC 1.0 project. Could you help with that? - em70

Possibly, but I don't have my laptop here at the moment. I can take a look tonight. - mgnoonan

Never mind, found something online that worked, now have to restore the connection strings :/ Thanks anyway - em70

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.