ASP.NET MVC on IIS 7.5

2018-12-31 14:38发布

I'm running Windows 7 Ultimate (64 bit) using Visual Studio 2010 RC. I recently decided to have VS run/debug my apps on IIS rather than the dev server that comes with it.

However, every time I try to run an MVC app, I get the following error:

HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory. Detailed

Error Information

Module DirectoryListingModule

Notification ExecuteRequestHandler

Handler StaticFile Error

Code 0x00000000 Requested

URL http://localhost:80/mySite/

Physical Path C:\myProject\mySite\

Logon Method Anonymous Logon

User Anonymous

I placed a default.aspx file in the directory and I received the following error:

HTTP Error 500.21 - Internal Server Error Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

Are there any other steps I forgot to take to get this working?

Notes: I installed IIS 7.5 after installing VS 2010 RC. I used the built-in "Create Virtual Directory" button under the "Web" tab in the MVC project's "Properties" in Visual Studio 2010. I made sure that the application is using the ASP.NET 4 App Pool.

Below are the installed features of IIS I have.

alt text

28条回答
深知你不懂我心
2楼-- · 2018-12-31 15:16

I had another problem that led to this issue.

  • I had ensured my app pool was running .net 4 in integrated mode
  • I had run aspnet_regiis.exe -i
  • I had checked folder permissions were set correctly for the account running my app pool

None of these things worked. It turned out that in my web.config under system.webserver > modules I had the following:

<remove name="WindowsAuthentication" />

Obviously this removed the windows authentication module which seemed to somehow knock everything off kilter.

I hope this helps someone, as this cost me most of an evening!

查看更多
萌妹纸的霸气范
3楼-- · 2018-12-31 15:17

In my case ASP.NET 4.5 is not installed on the server so installing ASP.NET 4.5 fixed the issue.

查看更多
情到深处是孤独
4楼-- · 2018-12-31 15:18

I created a new namespace (and therefore folder) identical to the route to a controller (e.g. MvcApp/Test/SomeClasses.cs and MvcApp/Controllers/TestController.cs). This resulted also in a 403.14!

查看更多
低头抚发
5楼-- · 2018-12-31 15:19

Another reason why someone might get this error is if the file Global.asax is not in the root folder anymore.

查看更多
君临天下
6楼-- · 2018-12-31 15:22

The UI is a bit different in the newer versions of Windows Server. Here is where you have to enable ASP.Net in order to get it working on IIS

Fix IIS & Asp.net

查看更多
只靠听说
7楼-- · 2018-12-31 15:22

ASP.NET 4 was not registered in IIS. Had to run the following command in the command line/run

32bit (x86) Windows

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir

64bit (x64) Windows

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir

Note from David Murdoch's comment:

That the .net version has changed since this Answer was posted. Check which version of the framework is in the %windir%\Microsoft.NET\Framework64 directory and change the command accordingly before running (it is currently v4.0.30319)

查看更多
登录 后发表回答