Clearing the IISExpress Cache

I am trying to clear the IISExpress cache from powershell. Using this code, he complains about the list.

"C:\Program Files (x86)\IIS Express\appcmd.exe" list site /xml | appcmd delete site /in

How can I clear IIS Express sites and cache?

 At line:1 char:50 + "C:\Program Files (x86)\IIS Express\appcmd.exe" list site /xml | app ... + ~~~~ Unexpected token 'list' in expression or statement. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnexpectedToken 
+9
powershell asp.net-mvc iis iis-express
source share
3 answers

Open the CMD prompt and go to IIS express - enter the following

 cd "C:\Program Files (x86)\IIS Express\" 

run this appcmd.exe list site /xml | appcmd delete site /in appcmd.exe list site /xml | appcmd delete site /in

This will delete all sites, enjoy!

+15
source share

In PowerShell, you need to use the call operator (&) to pass parameters / arguments to the executable.

Removed from this page: IIS Express site cleanup

 $appCmd = "C:\Program Files (x86)\IIS Express\appcmd.exe" $result = Invoke-Command -Command { & $appCmd 'list' 'sites' '/text:SITE.NAME' } for ($i = 0; $i -lt $result.length; $i++) { Invoke-Command -Command { & $appCmd 'delete' 'site' $result[$i] } } 

Deviation from comment this page :

 Set-Alias appcmd "$env:ProgramFiles\IIS Express\appcmd.exe" appcmd list site /text:SITE.NAME | % { appcmd delete site $_ } 
+4
source share
  1. Check Assembly.GetExecutingAssembly (). Location property when you debut and are stopped at some breakpoint
  2. you will see a location similar to the following path

C: \ Users \ YOURUSERSNAME \ AppData \ Local \ Temp \ Temporary ASP.NET files \ vs \ cf7d3a03 \ 8366a6d0 \ assembly \ dl3 \ c17148f6 \ bbf7eb43_d5cfd301 \ YOUR.dll

  1. so check and delete all the folders inside the path below (maybe after closing IIS express and VS)

C: \ Users \ YOURUSERSNAME \ AppData \ Local \ Temp \ Temporary ASP.NET Files \

0
source share

All Articles