Saturday, May 15, 2010

Creating website, application pool and cascading web applications programmatically

If you have ever tried creating a website in IIS 6.0 by using WMI object model you would know that it is not easiest thing to do. There was no native support from IIS object model, IIS 7.0 has much improved Application Programming Interface (API) set , it quite simpler and straight forward.

Microsoft.Web.Administration is name space which contains majority of server objects, it also provides a convenient way of manipulating configuration files including AdministrationHost File, All APIs in IIS 7.0 object model are managed code.

Here is code listing to create a simple HelloWorld site (You need to add reference to Microsoft.Web.Administration namespace, it usually located at C:\Windows\System32\inetsrv


Creating a website, application pool and application

ServerManager serverMgr = new ServerManager();

//Create website

Site mySite = serverMgr.Sites.Add("HelloWorld",@"C:\inetpub\wwwroot\HelloWorld", 9292);

//Create application pool

serverMgr.ApplicationPools.Add("HelloWorld");

//Create application

mySite.Applications.Add("HelloWorldApplication");

//assign application pool to site

mySite.Applications["HelloWorldApplication"].ApplicationPoolName = "HelloWorld";

mySite.ServerAutoStart = true;

serverMgr.CommitChanges();

more to follow....

Friday, January 08, 2010

Visual Studio 2010 beta and .NET 4.0 Framework

.NET 4.0 Framework Visual Studio 2010

Usefull links

Microsoft SharePoint 2010

Miscellaneous

New Year's Resolution - 2010

I've following technologies in mind to focus in 2010
  • Microsoft SharePoint Server 2010
  • Powershell
  • WPF Development
  • WCF Development