0

We developed an ASP.NET MVC version 5.2.7.0 application using the following technologies:

-ASP.NET MVC version 5.2.7.0

-.NET Framework 4.6.1

-Visual Studio 2019

We have to deploy said application to the following environment that contains a standalone IIS Server:

-32-bit Environment

-Windows Server 2008 R2 Enterprise (Service Pack 1)

-IIS Version 7.5

  • Also installed .NET Framework 4.6.1 Runtime and SDK

-8 GB RAM

It's a typical ASP.NET MVC setup and configuration:

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 }
        ); ................................... .................................................

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

It works when I run it in Visual Studio 2019 debug mode because it shows the default landing page with Application title.

However, when I deploy it to the standalone IIS Server, and just click "Browse" in IIS Manager, I get the following error:

HTTP Error 403.14 - Forbidden

A default document is not configured for the requested URL, and directory browsing is not enabled on the server.

It's really strange because the on the standalone IIS Server, the application in question has a bin directory that contains the Necessary files needed for 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

Could someone please tell me how to resolve the aforementioned error on the standalone IIS SErver?

crazyTech
  • 1,379
  • 3
  • 32
  • 67
  • 1
    Does this answer your question? [Set "Homepage" in Asp.Net MVC](https://stackoverflow.com/questions/1142003/set-homepage-in-asp-net-mvc) Visual Studio has the luxury to parse your code and know what to use as default page, but IIS don't. – Lex Li Jun 12 '20 at 05:08
  • 1
    Within the question, you will see my RouteConfig 's RegisterRoutes method already has "Default" route defined. But, I still get "403.14 - Forbidden", "A default document is not configured for the requested URL, and directory browsing is not enabled on the server." – crazyTech Jun 12 '20 at 12:49
  • Read the linked thread carefully. That route is different. – Lex Li Jun 12 '20 at 12:53

1 Answers1

1

The reason may be very simple, we need to enable certain windows features to support Asp.NET platform web application.
enter image description here
https://learn.microsoft.com/en-us/iis/application-frameworks/scenario-build-an-aspnet-website-on-iis/configuring-step-1-install-iis-and-asp-net-modules
Feel free to let me know if the problem still exists.

Abraham Qian
  • 7,117
  • 1
  • 8
  • 22