clearing IISExpress cache

痴心易碎 提交于 2019-11-30 12:09:34

问题


I am trying to clear up the IISExpress Cache from the powershell. Using this code it complains about the list.

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

How can I clear up the sites and the IIS Express 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

回答1:


Open CMD prompt & Navigate to IIS express - by typing the following

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

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

This will delete all the sites, enjoy!




回答2:


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

Taken from this page : Cleaning up IIS Express Sites

$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] }
}

Variation from a comment on this page :

Set-Alias appcmd "$env:ProgramFiles\IIS Express\appcmd.exe"

appcmd list site /text:SITE.NAME | % { appcmd delete site $_ }



回答3:


  1. Check the Assembly.GetExecutingAssembly().Location property when you are debgging and are stopped at some breakpoint
  2. you will see a location like below path

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

  1. so check out and delete all folders inside below path (propably possible after closing IIS express and VS)

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



来源:https://stackoverflow.com/questions/33790405/clearing-iisexpress-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!