« Previous Next »

Thread: Two sites with same virtual directory unable to have unique configurations

Last post 11-05-2009 2:11 AM by lextm. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 11-04-2009, 11:35 PM

    • SQLRocks
    • Not Ranked
    • Joined on 01-15-2008, 11:56 PM
    • Posts 11

    Two sites with same virtual directory unable to have unique configurations

    Hi All,

     I've got two sites on the same IIS7 server and they both have a virtual directory called "photos" which points to the same UNC path and directory. Both sites serve content from the "photos" virtual directory just fine.

    On "Site 1" I want to set the content to expire for the "photos" virtual directory to 20 minutes. When I do that a web.config file is generated in the physical location that maps to the "photos" virtual directory. Now both "Site 1" and "Site 2" have the same 20 minute expiration althugh my intent was NOT to have a 20 minute expiration for the "photos" virtual under "Site 2".

    I want both sites to share the same virtual directory (and no, it's not practical to copy the files to different locations) and yet I want each site to have it's own unique content expiration time. On the surface it appears that this can't be done.

     Any way around this issue?

     Thanks,

    -Phil

  • 11-05-2009, 2:10 AM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: Two sites with same virtual directory unable to have unique configurations

    The UI will write the configuration to the lowest possible place which is what you are seeing.  Ways to workaround this.

    a) Lock that particular config section (either at the root or site level) - the UI would then write the configuration with a location tag at the root or site level as appropriate.

    b) Use some other config tool eg ConfigEditor (part of admin pack), or appcmd (use -commitpath switch to control where the configuration is written) etc.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 11-05-2009, 2:11 AM In reply to

    • lextm
    • Top 10 Contributor
    • Joined on 10-22-2008, 12:18 AM
    • Shanghai, PRC
    • Posts 1,412

    Re: Two sites with same virtual directory unable to have unique configurations

    IIS Manager will try to save those settings in web.config file inside the directory, which prevents you from using different settings.

    Please learn more about IIS 7 configuration system about how to move the settings using location tag into upper level, such as applicationHost.config file.

    http://learn.iis.net/page.aspx/122/getting-started-with-iis-7-configuration/

     

    Lex Li
    Support Engineer at Microsoft
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
Page 1 of 1 (3 items)
Microsoft Communities