locked
DefaultDocument not working locally RRS feed

  • Question

  • User-935305436 posted

    When running live on Azure, setting the defaultDocument in web.config with the root directory works:

      <system.webServer>
        <defaultDocument>
          <files>
            <add value="~/Index.aspx"/>
          </files>
        </defaultDocument>
      </system.webServer>

    However, this does not work locally.  To get it to work locally, I must remove the tilde specifying the root document and just have Index.aspx.  The file is not in any subfolder.

    Currently, I have it set to work in Azure, and set a specific start page, which is functional, but not exactly the same thing.  I was wondering if there was a way to have both environments work without some kind of publish transform?

    I am aware you can set the default document from the Azure General settings as well, but I would like to have it work locally.

    Thursday, August 1, 2019 2:08 PM

All replies

  • User665608656 posted

    Hi Rstan,

    According to your description, could you tell us where your project stay?

    Azure web app? or Azure Virtual machine? 

    Different places need to consider different directions to explore this issue.

    Best Regards,

    YongQing.

    Friday, August 2, 2019 7:27 AM
  • User-935305436 posted

    Hello,

     It is an Azure Web App.  I believe it is specifically called an Azure "App Service" within the resource group.

    Friday, August 2, 2019 12:01 PM
  • User665608656 posted

    Hi Rstan,

    Based on your description, I recommend that you make transformation in web.config which contains Web.Debug.config and Web.Release.config files.

    You can select the index page in your current root directory as the default document  in one of the config files (like Web.Debug.config) in the local test environment.

    Then add the correct default document path to another config (like Web.Release.config ) and select this config type for publication.

    Here is a tutorial about this way : Web.config Transformation Syntax for Web Application Project Deployment

    Best Regards,

    YongQing.

    Tuesday, August 6, 2019 5:53 AM