Jan 13 2011

Announcing release of ASP.NET MVC 3, IIS Express, SQL CE 4, Web Farm Framework, Orchard, WebMatrix

Category:Bil@l @ 10:41

Read more by Scott Guthrie (Announcing release of ASP.NET MVC 3, IIS Express, SQL CE 4, Web Farm Framework, Orchard, WebMatrix)

 

Enjoy!

Tags: , ,

Mar 3 2008

Microsoft.Web.Administration API

Category: IIS | IIS 7.0 | Internet Information ServicesBil@l @ 06:59

In IIS 7.0, you can use one the following 4 ways to configure the IIS 7.0 settings configuration system:

  1. IIS 7.0 Manager tool.
  2. appcmd.exe command-line tool.
  3. Microsoft.Web.Administration managed API.
  4. Manual editing for the ApplicationHost.config file.

In this post I will introduce the Microsoft.Web.Administration API. The IIS 7.0 team thought of the developers and provided this managed API that allows you to access the configuration system of the IIS 7.0. The API get loaded into the machince once you install IIS and it is located at: %SystemDrive%\Windows\System32\Inetsrv\.

The major object in the API is the ServerManager class. It is a factory class that contains several important properties like the Sites, ApplicationPools, VirtualDirectories, etc .... For example, to create a new website on II 7.0, you can write the following:

            // Get a reference to the factory object
            // ServerManager
            var manager = new ServerManager();

            // Define a new website
            manager.Sites.Add(
                "ProgrammaticSite",
                @"D:\ProgrammaticSite\",
                8080);

            // Commit changes to the ApplicationHost.config
            manager.CommitChanges();

That's it!!

For a more detailed reference on the API, you can check the following article How to Use Microsoft.Web.Administration (http://learn.iis.net/page.aspx/165/how-to-use-microsoftwebadministration/)

Hope this helps,
Regards

 

Tags: , ,