【问题标题】:Standalone IIS Server Fails to start web application based on the start up url/ launch url/ default view独立 IIS 服务器无法根据启动 url/启动 url/默认视图启动 Web 应用程序
【发布时间】:2020-10-01 15:08:41
【问题描述】:

我们使用以下技术开发了 ASP.NET MVC 5.2.7.0 版应用程序:

-ASP.NET MVC 5.2.7.0 版

-.NET Framework 4.6.1

-Visual Studio 2019

我们必须将所述应用程序部署到以下包含独立 IIS 服务器的环境:

-32 位环境

-Windows Server 2008 R2 Enterprise (Service Pack 1)

-IIS 7.5 版

  • 还安装了 .NET Framework 4.6.1 Runtime 和 SDK

-8 GB 内存

这是一个典型的 ASP.NET MVC 设置和配置:

public class WebApiApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();
        GlobalConfiguration.Configure(WebApiConfig.Register);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
    }
}


public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        ); ................................... .................................................

.................................................. ..........

当我在 Visual Studio 2019 调试模式下运行它时它可以工作,因为它显示带有应用程序标题的默认登录页面。

但是,当我将它部署到独立的 IIS 服务器时,只需在 IIS 管理器中单击“浏览”,就会出现以下错误:

HTTP 错误 403.14 - 禁止

没有为请求的 URL 配置默认文档,并且 服务器上没有启用目录浏览。

这真的很奇怪,因为在独立的 IIS 服务器上,有问题的应用程序有一个 bin 目录,其中包含 ASP.NET MVC 所需的必要文件:

System.Web.Helpers.dll System.Web.Http.dll System.Web.Http.WebHost.dll System.Web.Mvc.dll System.Web.Optimization.dll System.Web.Razor.dll System.Web.WebPages.Deployment.dll
System.Web.WebPages.dll System.Web.WebPages.Razor.dll System.Xml.ReaderWriter.dll System.Xml.XDocument.dll System.Xml.XmlDocument.dll System.Xml.XmlSerializer.dll System.Xml.XPath.dll System.Xml.XPath.XDocument.dll

有人可以告诉我如何解决独立 IIS 服务器上的上述错误吗?

【问题讨论】:

  • 这能回答你的问题吗? Set "Homepage" in Asp.Net MVC Visual Studio 可以解析您的代码并知道将什么用作默认页面,但 IIS 没有。
  • 在问题中,您会看到我的 RouteConfig 的 RegisterRoutes 方法已经定义了“默认”路由。但是,我仍然得到“403.14 - Forbidden”,“没有为请求的 URL 配置默认文档,并且服务器上没有启用目录浏览。”
  • 仔细阅读链接的线程。那条路线不同。

标签: asp.net-mvc iis view routes url-routing


【解决方案1】:

原因可能很简单,我们需要启用某些windows功能来支持Asp.NET平台的web应用。

https://docs.microsoft.com/en-us/iis/application-frameworks/scenario-build-an-aspnet-website-on-iis/configuring-step-1-install-iis-and-asp-net-modules
如果问题仍然存在,请随时告诉我。

【讨论】:

    猜你喜欢
    • 2018-02-09
    • 2017-06-29
    • 1970-01-01
    • 2011-09-04
    • 2014-04-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多