|
If you create custom software that works with web servers, sooner or later you are going to want to be able to include some way to create and custom configure the IIS virtual directory that your application's web files should reside in, rather than depending on the uninitiated user to follow your instructions. I say this because personal experience has shown that the more you leave up to the user, the more time you'll be spending on the phone and via Email helping users to accomplish things that you originally thought would prove be "no - brainers"! Ah, Murphy's Law at work again!
Fortunately, starting with IIS 4.0 and now even more so in IIS 5.0, virtually everything about IIS is fully scriptable. You can set up web sites, configure users and permissions, set applications, determine process isolation, start and stop web sites and much, much more. The following annotated script shows how easy it is to do some of these items.
What we'll do here is what I would think is the most common scenario a developer might need:
1. Find the physical web root, and create a new physical folder under it for our application. 2. Create a new IIS virtual directory of the same name associated with the folder, and mark it as an IIS application. 3. Determine the name of the Anonymous IIS user account. 4. Set read, write and execute permissions for the Anonymous user. 5. Set Anonymous access on. 6. Go into the NTFS filesystem and set EXECUTE (Change) permissions on the folder for the IUSR account so that COM and COM+ dlls can be instantiated.
Having said all this, the basic process you'll see next can be easily modified by anyone willing to take ten minutes or so to read the IIS documentation. All the properties of the IIS Admin Base Object are there to see, fully laid out and expertly documented in the MSDN library. So let's get started. |