Mike Volodarsky's blog

Formerly the core server PM for IIS 7.0 and ASP.NET, now I run LeanSentry.
UPDATES: New troubleshooting guide released! Fix IIS website hangs →

At last, Visual Studio patch for F5 debugging on Windows Vista has been released

A Visual Studio patch that fixes the Visual Studio F5 debugging of IIS7 applications on Windows Vista Home Premium and above has been released! 

This patch solves the "An authentication error occurred while communicating with the web server.  Please see Help for assistance.", and "Debugging failed because integrated Windows authentication is not enabled.  Please see Help for assistance" errors, that until now had to be worked around using the instructions in my previous post on this matter.

For more information and download link, see my older post Fix problems with Visual Studio F5 debugging of ASP.NET applications on IIS7 Vista.

Thanks,

Mike

Do complex IIS management tasks easily with AppCmd command piping

As much as I hate to re-post someone else's content, I've been real busy in the past few weeks and havent had a chance to post new stuff - and today I saw Kanwal's post on a very near and dear subject of mine: AppCmd command pipelining.

Things you can do by piping appcmd commands

The post covers command pipelining, the advanced AppCmd feature that enables complicated management tasks to be expressed simply by combining multiple related appcmd commands, that operate on a pipeline of results generated by prevous commands.

For example:

AppCmd list apppools /state:Stopped finds the application pools that are stopped.

AppCmd start apppool XYZ starts the specified apppool.

What if you wanted to find the stopped apppools, and start them?  You could write a script, with a FOR loop, etc - or you can use AppCmd piping to do it like a pro:

AppCmd list apppools /state:Stopped /XML | AppCmd stop apppools /in

The /XML switch in the first command outputs the result of the first command in XML, and the /IN switch of the second command allows the list of apppools to stop to come in from STDIN.

This can be applied as many times as you want with most AppCmd commands.  Since appcmd allows you to query for objects with any of its properties, you can turn it the command piping ability into a very powerful way to do complex tasks - for example:

appcmd list sites /state:started /traceFailedRequestsLogging.enabled:true /XML |
     appcmd list apps /IN /XML |
        appcmd list apppools /IN /XML | 
            appcmd recycle apppools /IN

This finds all sites that are started and have Failed Request Tracing enabled, finds their applications, then finds the apppools to which they belong, and recycles them.

Before you ask - I designed and implemented this feature before I was exposed to Powershell, and was happy to see that Powershell supports this generically for most of its commands.  If I had known that ahead of time, I may have never implemented the support in AppCmd ... but as history would have it, I did, and now you get to take advantage of this capability in IIS7, without Powershell installed or the requirement to write your own powershell commandlets.

Read Kanwal's article for more examples of commands - I'll be sure to post my favorite ones, and some cool tricks using pipelining, in the near future.