Logo
  Saturday, January 19, 2019
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  
FastCGI for IIS
IIS Fast CGI grants common application structures which are platformed under FastCGI protocol the functionality to be ...
Web Playlists - IIS Extension
IIS Media Server Web Playlists extension grants hosters and developer’s unparalleled manipulation over media contents ...
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 ...
IIS Smooth Streaming Client
IIS Smooth Streaming Client permits the user to create rich client proficiencies which claims full usability advantage ...
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 ...
IIS Smooth Streaming Format SDK 1.0
IIS Smooth Streaming Format SDK 1.0 Beta 2 supplies samples, tools and documentations specific for usage in the ...
More