Setting Default WebPage in IIS 7.5

前端 未结 4 670
野的像风
野的像风 2020-12-17 04:12

I\'d a HD problem in machine where my Intranet IIS server was installed and I\'ve reinstalled all the software. I\'ve restored the site data into new IIS but now, when I typ

相关标签:
4条回答
  • 2020-12-17 04:23

    Put the following in site's or application's web.config file:

    <system.webServer>
        <defaultDocument>
            <files>
                <add value="~/Default.aspx"/>
            </files>
        </defaultDocument>
    </system.webServer>
    
    0 讨论(0)
  • 2020-12-17 04:24

    When you select your website or application in the left panel, there is an icon named "Default Document" on the middle, under IIS title. That is where that configuration is made from IIS Manager. Current default documents are listed and new ones can be created by clicking Add link on the Actions panel on right.

    0 讨论(0)
  • 2020-12-17 04:42

    Had the same problem in MVC project where I have put a default.aspx in the root
    It was not enough to only set web.config

    <system.webServer>
    <defaultDocument enabled="true">
        <files>
            <clear />
            <add value="Default.aspx" />
        </files>
    </defaultDocument>
    </system.webServer>
    

    Also had too add routes.IgnoreRoute(""); in RouteConfig.cs

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("");
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    

    I followed the guide: http://weblog.west-wind.com/posts/2013/Aug/15/IIS-Default-Documents-vs-ASPNET-MVC-Routes

    0 讨论(0)
  • 2020-12-17 04:43

    I was looking for the answer of same question. But these line helped me to achieve goal.

      <system.webServer>
            <httpRedirect enabled="true" destination="/Pages/ABC/xyz/" childOnly="true" />
            <defaultDocument>
                <files>
                    <add value="~/Default.aspx"/>
                </files>
            </defaultDocument>
      </system.webServer>
    
    0 讨论(0)
提交回复
热议问题