Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Creating Virtual Directories using DirectoryEntry - HRESULT: 0x8000500F
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Steve  
View profile  
 More options Apr 20 2005, 9:25 pm
Newsgroups: microsoft.public.adsi.general, microsoft.public.inetserver.iis
From: snesbit...@hotmail.com (Steve)
Date: 20 Apr 2005 04:25:27 -0700
Local: Wed, Apr 20 2005 9:25 pm
Subject: Creating Virtual Directories using DirectoryEntry - HRESULT: 0x8000500F
Hello,

The following C# method (taken from
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iiss...)
successfully creates a virtual directory at a specific location.

static void CreateVDir(string metabasePath, string vDirName, string
physicalPath)
    {
      //  metabasePath is of the form
"IIS://<servername>/<service>/<siteID>/Root[/<vdir>]"
      //    for example "IIS://localhost/W3SVC/1/Root"
      //  vDirName is of the form "<name>", for example, "MyNewVDir"
      //  physicalPath is of the form "<drive>:\<path>", for example,
"C:\Inetpub\Wwwroot"
      Console.WriteLine("\nCreating virtual directory {0}/{1}, mapping
the Root application to {2}:",
          metabasePath, vDirName, physicalPath);

      try
      {
        DirectoryEntry site = new DirectoryEntry(metabasePath);
        string className = site.SchemaClassName.ToString();
        if ((className.EndsWith("Server")) ||
(className.EndsWith("VirtualDir")))
        {
          DirectoryEntries vdirs = site.Children;
          DirectoryEntry newVDir = vdirs.Add(vDirName,
"IIsWebVirtualDir");
          newVDir.Properties["Path"][0] = physicalPath;
          newVDir.Properties["AccessScript"][0] = true;
          // These properties are necessary for an application to be
created.
          newVDir.Properties["AppFriendlyName"][0] = vDirName;
          newVDir.Properties["AppIsolated"][0] = "1";
          newVDir.Properties["AppRoot"][0] = "/LM" +
metabasePath.Substring(metabasePath.IndexOf("/", ("IIS://".Length)));

          newVDir.CommitChanges();

          Console.WriteLine(" Done.");
        }
        else
          Console.WriteLine(" Failed. A virtual directory can only be
created in a site or virtual directory node.");
      }
      catch (Exception ex)
      {
        Console.WriteLine("Failed in CreateVDir with the following
exception: \n{0}", ex.Message);
      }
    }

The limitation is that the virtual directory can only be created under
a Server or VirtualDir object.  My IIS has the following structure:

[site]/[vdir]/[subfolder]

Where [site] is an iis site, [vdir] is a virtual directory and
[subfolder] is a folder that resides under the physical folder that is
pointed to by [vdir].  Now, I can successfully create a new virtual
directory under [vdir], but what I want to do is create one under
[subfolder].

I can do this manually within IIS but not programmatically.  The
SchemaClassName reported by DirectoryEntry for [subfolder] is
IIsObject, so the above code in it's original form (correctly) falls
to the else branch.  If I modify the if statement and attempt to
create the virtual directory under [subfolder] I get a HRESULT:
0x8000500F exception.

According to (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi...)
this means "E_ADS_SCHEMA_VIOLATION - The attempted action violates the
directory service schema rules".

So, if I can create a virtual directory manually in IIS at this
location, even though the SchemaClassName is not strictly a
VirtualDir, why cant I do it programmatically using DirectoryEntry
methods?  Is there a workaround for this?  Can I "cast" the
SchemaClassName of IIsObject to IIsWebVirtualDir?  Any other hints or
tips?

Thanks in advance,

Steve


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
snesbit...@hotmail.com  
View profile  
 More options Apr 20 2005, 9:34 pm
Newsgroups: microsoft.public.adsi.general, microsoft.public.inetserver.iis
From: snesbit...@hotmail.com
Date: 20 Apr 2005 04:34:49 -0700
Local: Wed, Apr 20 2005 9:34 pm
Subject: Re: Creating Virtual Directories using DirectoryEntry - HRESULT: 0x8000500F

Hello,

Should have mentioned in my related post that I am working on Windows
Server 2003 Standard Edition.

Cheers,

Steve

Steve wrote:
> Hello,

> The following C# method (taken from

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iiss...)

(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi...)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Kaplan (MVP - ADSI)  
View profile  
 More options Apr 21 2005, 12:48 am
Newsgroups: microsoft.public.adsi.general
From: "Joe Kaplan \(MVP - ADSI\)" <joseph.e.kap...@removethis.accenture.com>
Date: Wed, 20 Apr 2005 09:48:14 -0500
Local: Thurs, Apr 21 2005 12:48 am
Subject: Re: Creating Virtual Directories using DirectoryEntry - HRESULT: 0x8000500F
Hi Scott,

I would suggest two things:
Repost on microsoft.public.platformsdk.adsi.iis-admin
Consider using WMI (System.Management) for modifying IIS instead of ADSI/SDS

There are some known bugs in the SDS implementation which cause problems
with the IIS provider.  I think a lot of these have been resolved in .NET
2.0, but that might not help you.  I'm also not an expert, so I have no idea
if this is the issue or not, but it is something to think about.

GL,

Joe K.

<snesbit...@hotmail.com> wrote in message

news:1113996889.223498.104180@o13g2000cwo.googlegroups.com...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Kaplan (MVP - ADSI)  
View profile  
 More options Apr 21 2005, 12:50 am
Newsgroups: microsoft.public.adsi.general
From: "Joe Kaplan \(MVP - ADSI\)" <joseph.e.kap...@removethis.accenture.com>
Date: Wed, 20 Apr 2005 09:50:53 -0500
Local: Thurs, Apr 21 2005 12:50 am
Subject: Re: Creating Virtual Directories using DirectoryEntry - HRESULT: 0x8000500F
Sorry Steve, I called you Scott.  :)

Joe
"Joe Kaplan (MVP - ADSI)" <joseph.e.kap...@removethis.accenture.com> wrote
in message news:OVEP8fbRFHA.3704@TK2MSFTNGP12.phx.gbl...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve  
View profile  
 More options Apr 21 2005, 6:04 pm
Newsgroups: microsoft.public.adsi.general
From: snesbit...@hotmail.com (Steve)
Date: 21 Apr 2005 01:04:04 -0700
Local: Thurs, Apr 21 2005 6:04 pm
Subject: Re: Creating Virtual Directories using DirectoryEntry - HRESULT: 0x8000500F
Thanks Joe,

I have re-posted on the newsgroup you mentioned and will investigate
your WMI suggestion.  I'll post a follow-up to this thread if any
breakthroughs materialise.

Steve

"Joe Kaplan \(MVP - ADSI\)" <joseph.e.kap...@removethis.accenture.com> wrote in message <news:eV0ObhbRFHA.3928@TK2MSFTNGP09.phx.gbl>...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve  
View profile  
 More options Apr 23 2005, 12:10 am
Newsgroups: microsoft.public.adsi.general, microsoft.public.inetserver.iis
From: snesbit...@hotmail.com (Steve)
Date: 22 Apr 2005 07:10:51 -0700
Local: Sat, Apr 23 2005 12:10 am
Subject: Re: Creating Virtual Directories using DirectoryEntry - HRESULT: 0x8000500F
No breakthroughs yet, but curiously I discovered that the
DirectoryEntry object is able to remove the virtual directory from my
desired location if I create it there manually - but it just won't
create it under an IIsObject node.  This strongly suggests a bug in
the DirectoryEntry.Add method.  Can anyone from
Microsoft confirm this?  Better yet, is there a workaround?

Thanks in advance


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google