ingredient_15939
ingredient_15939

Reputation: 3124

Running IIS Express "silent", ie without HTTP console output?

I'm testing the responsiveness of a web application, and want to isolate any slow areas (database access, javascript, etc) and want to be sure that IIS Express isn't slowing things down by all its console output.

Is there a way of running IIS Express without that output, or even without the console being visible at all?

I've tried the /trace:error option, but it still outputs lines for every request.

Upvotes: 0

Views: 1211

Answers (1)

Michael
Michael

Reputation: 46

the following should do the trick:

Create a VBScript: IIS-Express-silent.vbs

Dim App,Site   
Site = "[YOUR SITE NAME]"

If Len(Site) < 1 Then
    Site = WScript.Arguments(0)
End If
App = """%PROGRAMFILES%\IIS Express\iisexpress""" & _
          " /site:" & Site

If Len(Site) > 0 Then
    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run App, 0
    Set WshShell = Nothing
End If

If you are running IIS Express only as localhost and you don't (intend to) use SSL then you are ready. Just add [YOUR SITE NAME] from applicationhost.config located in your user profile:

<sites>
    <site name="[YOUR SITE NAME]" id="1" serverAutoStart="true">
    ...
</sites>

If you need elevated privileges you must create a second file in the same directory (VBScripts can't be run this way directly): Run-as-Administrator.bat

@echo off
pushd %~dp0
cscript IIS-Express-silent.vbs [YOUR SITE NAME]

Please leave Site in your VBScript blank then and add the name in your batch file instead.

Right mouse button - "Run as Administrator" - and you're done :-)

Upvotes: 3

Related Questions