Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7190917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:37:08+00:00 2026-05-28T19:37:08+00:00

I have a web application that deploys with two virtual directories under it’s IIS

  • 0

I have a web application that deploys with two virtual directories under it’s IIS virtual application. On IIS 6 boxes, the following code creates these virtual directories as expected, however on IIS 7 boxes, I end up with my virtual application having two other virtual applications under it, rather than one virtual application with two virtual directories under it. I’ve tried the following two methods, but both still create a virtual application, not a virtual directory. How can this code be changed to deploy the needed virtual directories, not the undesired virtual applications?

one:

private void AddVirtualDir(DirectoryEntry entry)
{
    DirectoryEntry virtualDirectory = (DirectoryEntry)entry.Invoke("Create", "IIsWebVirtualDir", "VirtualDirectory");
    virtualDirectory.InvokeSet("Path", @"VirtualPath");
    virtualDirectory.InvokeSet("AppFriendlyName", "VirtualDirectory");
    virtualDirectory.Properties["AccessRead"][0] = true;
    virtualDirectory.Properties["AccessScript"][0] = 512;
    virtualDirectory.Properties["AppIsolated"].Clear();
    virtualDirectory.Properties["AppIsolated"].Add(2);
    virtualDirectory.Invoke("AppCreate", false);
    virtualDirectory.CommitChanges();
    entry.CommitChanges();
}

two:

private void AddVirtualDir(DirectoryEntry entry)
{
    var virtualDirectory = entry.Children.Add("VirtualDirectory", "IIsWebVirtualDir");
    virtualDirectory.Properties["AccessRead"][0] = true;
    virtualDirectory.Properties["AccessScript"][0] = 512;
    virtualDirectory.Properties["AppFriendlyName"][0] = "EditorControls";
    virtualDirectory.Properties["AppIsolated"][0] = 2;
    virtualDirectory.Properties["Path"][0] = Path.Combine(_INSTALLDIR, @"Kryptiq_Root\FormManagement\EditorControls");
    virtualDirectory.CommitChanges();
    entry.CommitChanges();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:37:09+00:00Added an answer on May 28, 2026 at 7:37 pm

    How this works on IIS6

    The problem here is that you’re setting the AppIsolated value. In IIS6 this is used to configure how an application should run, and generally you should never need to touch this or add it anywhere.

    AppIsolated always defaults to 2 which means pooled process, i.e. the application will run in either the parent application’s application pool or in the pool specified by AppPoolId.

    The reason that there are other values is so that you can configure an application to run in a couple of legacy IIS5 modes – In Process and Out of Process mode.

    So unless you configured your site’s /root application to run as anything other than AppIsolated="2" then you don’t need to set this value.

    Your code can be as simple as:

    using (var entry = new DirectoryEntry("IIS://localhost/W3SVC/1/ROOT"))
    {
      using (DirectoryEntry virtualDirectory = entry.Children.Add("MyVdir", 
                                               "IIsWebVirtualDir"))
      {
        virtualDirectory.Properties["Path"][0] = PATH_TO_MY_STUFF;
        virtualDirectory.Properties["AccessRead"][0] = true;
        virtualDirectory.Properties["AccessScript"][0] = 512;
        virtualDirectory.CommitChanges();
      }
    }
    

    If you do set AppIsolated in IIS6 it gets ignored because for the directory to become an application you also need to set AppRoot.

    IIS7 – IIS6 compatibility shim

    In IIS7 when using System.DirectoryServices you’re working with an underlying II6 compatibility API which is translating these ADSI calls to calls to the new IIS7 API. It’s not perfect and I suspect that when it see’s AppIsolated being set it’s assuming you want an application, despite you not specifying any other application related metabase values.

    IIS7 Managed API is better

    You probably know this, but it’s better to work with IIS7 configuration via the managed Microsoft.Web.Administration bits. Not all of the ADSI/metabase compatibility settings have equivalents in IIS7 which can force the translation layer to make compromises to work around this. I mention these types of problems in my answers here and here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that is load balanced across two web servers (soon to
Basically I have two applications: a PHP web application that runs over Apache and
I have two completely independent web application that each use a shared core dll.
I have a C# web application that needs to deploy a file to the
I have a web application that uses a number of WCF Services. I deploy
I have 6 servers that i need to deploy my ASP.NET web application to.
I have a web application that should behave differently for internal users than external
I have a web application that is becoming rather large. I want to separate
I have a web application that needs to take a file upload from the
I have this web application that has grown to an unmanageable mess. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.