我使用Visual Studio 2010 RC运行Windows 7 Ultimate(64位)。我最近决定让VS在IIS上运行/调试我的应用程序,而不是在附带的开发服务器上。

然而,每次我尝试运行MVC应用程序,我得到以下错误:

HTTP错误403.14 -禁止Web服务器被配置为不列出此目录的内容。详细的

错误信息

模块DirectoryListingModule

通知ExecuteRequestHandler

汉德勒统计错误

代码0x00000000请求

URL http://localhost: 80 / mySite /

物理 路径C: \ myProject \ mySite \

登录方法匿名登录

匿名用户

我设置了一个默认值。aspx文件在目录中,我收到以下错误:

HTTP错误500.21 -内部服务器 错误处理程序 "PageHandlerFactory-Integrated"有一个 坏模块“ManagedPipelineHandler”在 其模块列表

还有其他我忘了做的步骤吗?

注意:我在安装VS 2010 RC之后安装了iis7.5。在Visual Studio 2010中,我使用了MVC项目的“属性”中“Web”选项卡下的内置“创建虚拟目录”按钮。我确保应用程序使用的是ASP。NET 4应用程序池。

下面是我已经安装的IIS特性。


当前回答

我一度改变了我的默认路线:

routes.MapRoute(
"Default",
    "{controller}/{action}/{id}",
    new { controller = "Home", action = "Index", id = UrlParameter.Optional }

To:

routes.MapRoute(
"Default",
    "{controller}/{action}/{id}",
    new { controller = "Home", action = "Index" }

这就给出了你的误差。很高兴有人提到了路由,因为我可能永远都在这上面。

其他回答

根据http://support.microsoft.com/kb/980368,尝试为您的系统安装这个知识库。如果你看到404,这可能是因为你没有这个更新-和isapi模块只是没有找到,没有这个没有很多你可以做的!

对于我来说,在Azure Server 2012 R2 IIS 8.5虚拟机上使用Asp。Net MVC 5应用程序(bin部署MVC 5)我必须从一个提升cmd提示符做以下工作,即使我已经安装了4.5:

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

来源:http://support.microsoft.com/kb/2736284

我还使用以下PowerShell强行安装了所有IIS功能:

import-module servermanager
add-windowsfeature web-server -includeallsubfeature

来源:http://www.iis.net/learn/install/installing - iis 85/installing iis - 85 - windows server 2012 r2

现在我的应用程序正在工作。

我也收到这个错误,发现“HTTP重定向”没有在Windows服务器中打开。这篇博文也指出了这一点:http://blogs.msdn.com/b/rjacobs/archive/2010/06/30/system-web-routing-routetable-not-working-with-iis.aspx

要解决这个问题,而不必诉诸32位模式,您将不得不更新此项目的源代码

public static void RegisterUrlRoutesFromAttributes(RouteCollection routes)
{
    // Enumerate assembly for UrlRoute attributes.
    List<MapRouteParams> routeParams = new List<MapRouteParams>();
    AppDomain.CurrentDomain.GetAssemblies()
        .ToList()
        .ForEach(assembly => routeParams.AddRange(GetRouteParamsFromAttributes(assembly)));

我在IT云codeplex项目的讨论板上提出了这个问题。

http://itcloud.codeplex.com/discussions/262000

ASP。NET 4未在IIS中注册。必须在命令行中运行以下命令/run

32位(x86) Windows

% windir % \微软。NET框架v4。0。30319 \ aspnet_regiis . exe。-ir

64位(x64) Windows操作系统

% windir % \微软。NET Framework64 v4。0。30319 \ aspnet_regiis . exe。-ir

David Murdoch的评论如下:

.net版本已经改变 自从这个答案发布后。检查 框架的版本是什么 %列出% \微软。净\ Framework64 目录并更改命令 因此,在运行之前(它是 目前v4.0.30319)