LINQ with IIS sites and web Applications

No.of Views2166
Bookmarked0 times
Downloads 
Votes0
By  Dhananjay Kumar   On  10 Aug 2010 08:08:42
Tag : LINQ , General
In this article, we will see how to work with LINQ against IIS.
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

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

Download   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. 

Image Loading

Step 3

Add the name space 

Image Loading

Now we are ready to perform the query,

Display all the sites

Image Loading

Output

Image Loading

Display all the sites which is started 

Image Loading

Output 

Image Loading

Display Site running in a particular application pool

Image Loading

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 

Image Loading

Conclusion

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

 
Sign Up to vote for this article
 
About Author
 
Dhananjay Kumar
Occupation-Software Engineer
Company-Infosys Technolgies,Pune
Member Type-Gold
Location-India
Joined date-20 Jul 2009
Home Page-http://dhananjaykumar.net/
Blog Page-http://dhananjaykumar.net/
Dhananjay Kumar is Microsoft MVP on connected system. He blogs at http://dhananjaykumar.net/ . You can follow him http://twitter.com/debugmode_/ and reach him at dhananjay.25july@gmail.com
 
 
Other popularSectionarticles
    Deferred Execution executes the query only when Loop starts. What I mean here is that, we iterate through the query variable to get the result.
    Published Date : 15/Jan/2011
    In this article we will focus LINQ Remote and Local exaction such as This query executes on the server, Remote execution of query is default in LINQ, In Remote execution advantage of Databases index can be taken, Remote execution allows us to take the advantage of Database server engine, Remote execution allows us to only select particular rows from the table. This is very useful when we do have large amount of data in the server.
    Published Date : 07/Jan/2011
    how to create a XML tree using Functional Construction method of LINQ to XML.
    Published Date : 13/Apr/2010
    This article demonstrates how to use LINQ on DataTable, XML Data using LINQ to XML and SQL server data base using LINQ to SQL Classes.
    Published Date : 28/Jun/2010
    In this article we will focus, how to read CSV file using LINQ to CSVProvider.I hope we know read CSV file using StreamReader or any other readers in C#. But when we are use the LINQ to CSVProvider, and then we could get additional features to query data in LINQ as like Sql Query.
    Published Date : 01/Jan/2011
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top
</