Logo
  Wednesday, November 14, 2018
Sign-In  |  Sign-Up  |  Contact Us  | Bookmark |  RSS Feed

Developing for IIS with Microsoft.Web.Administration  
Developing for IIS is new option available with the arrival of IIS API library called: Microsoft.Web.Administration. You need to make sure reference is included into your Web project before proceeding with the code. We provide you with the code snippets that you may use in your development for IIS. Code sample is written in VB.NET but you should be able to understand it in C# as well . Let say we are tasked for creation of the new site programmatically.

First step is to declare ServerManager object in your code behind. This allows us to access properties and method required for the next step.

Dim SM As New ServerManager
Dim bindingInfo As String
Dim mySite As Site

Second, we need to create an App Pool for this site which is done via call to ApplicationPools.Add method of the ServerManager.

SM.ApplicationPools.Add(AppNameTextBox.Text)

Third, we proceed with the creation of the site itself with the help of another Method of ServerManager call Sites.Add

mySite = SM.Sites.Add(SiteNameTextBox.Text, "HTTP", bindingInfo, PathTextBox.Text)

Finally, we need to associate Application Pool that we created in step two with our website. This is done in the following way.

mySite.Applications(0).ApplicationPoolName = NameTextBox.Text

All work is done and we need to make sure it is committed into our object model via call to CommitChanges method. SM.CommitChanges()

Print Developing for IIS with Microsoft.Web.Administration Bookmark Developing for IIS with Microsoft.Web.Administration

Related Articles  
Windows Cache Extension for PHP - IIS Extension
Windows Cache Extension for PHP is an IIS extension design to accelerate PHP applications which are paltformed on ...
Live Smooth Streaming in IIS 7.0 and 7.5
Live Smooth Streaming for IIS Media Services 3.0 is an extension which capacitates the process of adaptive streaming of ...
IIS Smooth Streaming Player Development Kit (SSPDK)
Recently, Microsoft has just announced the release of the IIS Smooth Streaming Player Development Kit (SSPDK) 1.0. It ...
Supported Application Frameworks on IIS
IIS 7.0 and 7.5 are designed to support legacy application so that transition is ease, allowing to deploy websites ...
Smooth Streaming IIS Extension
IIS Media Services Smooth Streaming extension grants the ability to process variable media streaming targeting ...
Bit Rate Throttling in IIS 7.0 and 7.5
Another IIS Media Services extension is Bit Rate Throttling – procedurally meters the network cost values by measuring ...
More