Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
BRH 58
#ASP.NET 55
ASP.NET 50
#DOTNET 49
.NET 40
WCF 21
DOTNET 12
c# 8
windows azure 7
SILVERLIGHT 7

Archive · View All
April 2011 9
March 2011 9
February 2011 8
December 2010 7
November 2010 5
September 2010 5
August 2010 5
May 2011 4
October 2010 4
January 2011 2

Using LINQ to run queries against IIS web sites and web Applications

Aug 9 2010 6:02AM by Dhananjay Kumar   

Objective

In this article, we will see how to work with LINQ against IIS.

Before applying LINQ against IIS sites and application pool, we need to set up the environment. Follow the bellows steps to do this.

Step 1

Down load Microsoft.Web.Administration.dll and save to a particular directory. I am saving it in D drive of local storage.

Step 2

Create a new console project and add Microsoft.Web.Administration dll as service reference. To add a reference right click on the project and click add service reference. Then browse to the directory where, we have saved the downloaded dll of the first step.

File selection dialog - linq query against iis

Step 3

Add the name space

using Microsoft.Web.Administration;

Now we are ready to perform the query,

Display all the sites

ServerManager manager = new ServerManager();
foreach (var r in manager.Sites)
{
    Console.WriteLine(r.Name);
}

Output

Ling query against IIS displaying all sites

Display all the sites which is started

ServerManager manager = new ServerManager();
var res = from r in manager.Sites
          where 
              r.State == ObjectState.Started
          select r;
foreach (var r in res)
{
    Console.WriteLine(r.Name);
}

Output

LINQ query against IIS displaying all sites that started

Display Site running in a particular application pool

ServerManager manager = new ServerManager();
var res = from r in manager.Sites
          where 
              k.ApplicationPoolName.Equals (
                 "Default Web Site",
                 StringComparison.InvariantCultureIgnoreCase )		
          select r;
foreach (var r in res)
{
    Console.WriteLine(r.Name);
}

In above query, we are performing nested query. We are just comparing if application pool name is as same as given name or not.

Output

LINQ query against IIS displaying all sites using a particular application pool

Conclusion

In above article, I just discussed three basic LINQ query against IIS. I hope this post was useful . Thanks for reading. Happy Coding.

Tags: #DOTNET, #LINQ, LINQ, BRH,


Dhananjay Kumar
49 · 4% · 1198
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]