0

I am trying to deploy my website online but it gives me this error

iis 8.5 The Web server is configured to not list the contents of this directory.

It is working on localhost. Also, if I configure my cloud settings to use cloud storage it works fine. But I am not sure what is the issue. After searching the web I added this

<modules runAllManagedModulesForAllRequests="true">

in my web.config file but still doesn't work.

My RouteConfig.cs looks like this

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

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Site", action = "Index", id = UrlParameter.Optional },
            constraints: new { subdomain = new SubdomainRouteConstraint("www") },
            namespaces: new string[] { "DeltaNorgeWebsite.Controllers" }
        );

        routes.MapRoute(
            name: "Files",
            url: "{id}",
            defaults: new { controller = "File", action = "Index" },
            constraints: new
            {
                subdomain = new SubdomainRouteConstraint("files")
            }
        );

#if DEBUG
        // redirect localhost
        routes.MapRoute(
            name: "LocalhostRedirect",
            url: "",
            defaults: new { controller = "Redirect", action = "Index", path = "http://www.delta-norge.com" },
            constraints: new
            {
                subdomain = new SubdomainRouteConstraint("localhost")
            }
        );
#endif

    }

This is the link to the website

http://deltanorge.cloudapp.net/

mohsinali1317
  • 4,255
  • 9
  • 46
  • 85

2 Answers2

0

You can solve this in 2 ways:

1) enable "Directory Listing" for the web site in your IIS manager

2) set a default document for your website

Mivaweb
  • 5,580
  • 3
  • 27
  • 53
0

Your localhost doesn't know which file it should serve. Use this in your web.config

    <system.webServer>
    <defaultDocument>
      <files>
        <add value="formpage.aspx" /> <!-- write your main page here -->
      </files>
    </defaultDocument>
    <directoryBrowse enabled="false" />
  </system.webServer>
liomc
  • 1
  • 1