ASP.NET MVC on IIS falls through to the static file handler

前端 未结 5 1462
抹茶落季
抹茶落季 2020-12-24 07:33

I have a problem with an ASP.NET MVC site.

These are the details:

  1. ASP.NET MVC 2
  2. ASP.NET 4 integrated pipeline
  3. IIS 7.5 on Windows Web
相关标签:
5条回答
  • 2020-12-24 07:59

    In my case, a similar error was thrown because StaticFile Handler was disabled / not working properly. I eventually fixed it by removing the handler and re-adding it through the web.config. Also, in case of a 403.3 error, change the RequireAccess-property value from "Write" to "Read"

    <configuration>
        <system.webServer>
            <handlers>
               <remove name="StaticFile"
                <add 
                    name="StaticFile" 
                    path="*" verb="*" 
                    modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" 
                    resourceType="Either" 
                    requireAccess="Read" />
            </handlers>
        </system.webServer>
    </configuration>
    
    0 讨论(0)
  • 2020-12-24 08:01

    I see you fixed your issue, but for anyone googling:

    I had this issue and in my case I just needed to register ASP.NET 4 with IIS. I was deleting and re-adding webs to fix other issues and simply forgot to do that. The command that worked for me was:

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -i

    Your own .net version may be different, especially if you are in the future, so the above path may not be exactly right.

    0 讨论(0)
  • 2020-12-24 08:01

    Chris' answer got me to check whether the app pool was actually configured for .net 4. Sure enough, this server defaults to creating 32-bit .net 2 pools in classic mode.

    Ensure that your app is using 4.0 and you'll probably want Integrated pipeline for all new development. 32/64 is mainly up to your dependencies. The default is leaving "allow 32 bit allocations" set to false.

    0 讨论(0)
  • 2020-12-24 08:02

    I had the same problem when I installed IIS after installing Visual Studio, etc.

    I was able to fix the problem by changing my Web.config file, adding the runAllManagedModulesForAllRequests="true" to the <modules> tag:

    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true">
            ...
        </modules>
    </system.webServer> 
    

    (More details/copied from here: http://www.west-wind.com/weblog/posts/2011/Mar/27/ASPNET-Routing-not-working-on-IIS-70)

    0 讨论(0)
  • 2020-12-24 08:14

    So I found the error. There was a left over default document in the root, which isn't necessary for apps using the integrated pipeline. Also some changes to Global.ascx and route registration was neessary, but after that it worked.

    0 讨论(0)
提交回复
热议问题