2
votes

I am trying to add a website on IIS 5.1

When I try to create an application pool for my new site with my function below, I have this strange error "system.directoryNotFound Exception ... in CreateAppPool"

The strangest thing is that the creation of the application pool function perfectly on a pc windows 7 with IIS7 but not on windows XP with ISS5.1 The following path "IIS :/ / localhost/W3SVC/AppPools" is different on IIS5.1?

public static CreateAppPool(string name)
        {
            string machineName = System.Environment.GetEnvironmentVariable("COMPUTERNAME");
            DirectoryEntry Service = new DirectoryEntry("IIS://"+machineName+"/W3SVC/AppPools");

            // create new app pool
            DirectoryEntry appPool = Service.Children.Add(name, "IIsApplicationPool");
            appPool.CommitChanges();
            Service.CommitChanges();

        }
1
Its not possible to use a .NET language if you are using IIS 5.1 since it only supported classical ASP. You need to update to IIS 6.0 which added support for ASP.NET. In an ideal world you would use neither since neither are secure in today's world.Security Hound
mhh i see ! ok thank you !!!Mehdi Bugnard

1 Answers

4
votes

You can't create an application pool in IIS 5, but you can create a new virtual directory under the Default Web site and make it an application.