Set IIS Website Properties

Any suggestions on how to automate the setting of web site properties within IIS 6?  Things like "application pool" and "default content page"?  I can create an IIS 6 Website just fine, and I can create a IIS 6 Application pool, but I can't figure out how to set the application pool for the newly created website.

 

jason

Hi Jason,

Not possible in the current version, we’re updating the actions now and will have a new test build available soon.

Regards,
Paul.

Great.  Looking forward to trying it out.

In the interim I created a console app and used the Execute Action to automate the setting of properties.  For those of you out that there that are trying to figure this out, here is a C# snippet to set a wildcard script map. a simple property setter and a method for displaying all the current properties.

namespace SetIISWebProperties
{
    using System;
    using System.Collections.Generic;
    using System.DirectoryServices;

        public class IisWebSite
        {
            private readonly DirectoryEntry _website;
            private readonly DirectoryEntry _webdir;

            public IisWebSite(DirectoryEntry de)
            {
                _website = de;
                _webdir = new DirectoryEntry(_website.Path + "/ROOT");
            }

            public void DisplayAllProperties()
            {
                foreach (PropertyValueCollection pvc in _website.Properties)
                {
                    var name = pvc.PropertyName;
                    var value = pvc.Value;
                    Console.WriteLine("{0}: {1}", name, value);
                }
            }

            public void SetProperty(string propertyName, string value)
            {
                _website.InvokeSet(propertyName, value);
                _website.CommitChanges();
            }

            public bool AddWildCardScriptMap()
            {
                var scriptMapPvc = _webdir.Properties["ScriptMaps"];

                // verify script map doesn't exist (only add if it does not exist)
                foreach (string scriptMapProperty in scriptMapPvc)
                {
                    var scriptMapValues = scriptMapProperty.Split(',');
                    if (scriptMapValues[0].ToLower() == "*")
                    {
                        return false;
                    }
                }

                // if we got here, add the wildcard script map with the specified value
                scriptMapPvc.Add(@"*,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,0,All");
                _webdir.CommitChanges();

                return true;
            }

     }

}

 

Automating System.DirectoryServices is the key.

Hi Jason,

Here is the new build of FinalBuilder which allows you to specify an application pool and default document when creating a new website.

URL: https://www.finalbuilder.com/downloads/finalbuilder/630/FB630_2114.exe

Regards,
Paul.

I’m still running an eval copy … can I install this version without affecting the remaining days on the eval?

This version you posted for Jason, does it support TFS 2010?

Nick

Hi Jason,

Yes, you can install the newer version without affecting the trial.

Regards,
Paul.

Hi Nick,

No, this is an update to FinalBuilder 6, see Ben’s reply on this thread for information on the status of TFS2010 in FinalBuilder 6

URL: https://www.finalbuilder.com/forums.aspx?aft=9848

Regards,
Paul.