Can't run ASP.NET MVC 2 web app on IIS 7.5

北城余情 提交于 2019-11-27 00:16:41

Ok, this is resolved for me, by doing the following:

Running aspnet_regiis -i in the 32-bit directory c:\Windows\Microsoft.NET\Framework\v4.0.30319.

At this point, I don't understand why 64-bit mode isn't working, but I'm now unblocked. Hopefully this helps anyone else who is having this issue.

I had exactly the same issue, so thanks for your help.

However... did you try running the aspnet_regiis -i command in the Visual Studio 64 bit command prompt (with admin privileges)? When I did that it fixed it for the 64-bit mode.

To clarify, I right clicked on Visual Studio x64 Win64 Command Prompt (2010) and chose Run as Administrator. Then I went here:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319

And did this: aspnet_regiis -i

And now it works perfectly.

Also ensure that you configuration file has the following line otherwise the routing will not work.

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

Don't use runAllManagedModulesForAllRequests. You want to let IIS handle resources such as images.

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

Instead add the MVC routing module

<system.webServer>
  <modules>
    <remove name="UrlRoutingModule-4.0" />
    <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
  </modules>
</system.webServer>

Another thing to note, make sure your application pool is set to integrated, not classic

I had this same problem on IIS8 / Windows Server 2012. None of the many proposed solutions worked until I tried the following.

dism /online /enable-feature /featurename:IIS-ASPNET45 /All

Without the '/All' switch it complained that a parent feature was not installed.

The strange thing is that according to Windows' Turn Windows Features on or off facility, asp.net 4.5 was already installed.

There was no need to make any changes to the web.config, add or remove modules.

I've always used the custom server setting in VS 2008, which still allows me to debug with no problems. Not sure if it works any differently in 2010

I had these symptoms; My Global.asax was crashing. Fixed the crash, everything is working now.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!