asp.net-mvc 清除 IISExpress 缓存

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33790405/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-07 23:30:17  来源:igfitidea点击:

clearing IISExpress cache

asp.net-mvcpowershelliisiis-express

提问by aggie

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

我正在尝试从 powershell 中清除 IISExpress 缓存。使用此代码它会抱怨列表。

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

"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?

如何清除站点和 IIS Express 缓存?

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

回答by transformer

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

打开 CMD 提示并导航到 IIS express -通过键入以下内容

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

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

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

运行这个 appcmd.exe list site /xml | appcmd delete site /in

This will delete all the sites, enjoy!

这将删除所有网站,享受!

回答by sodawillow

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

在 PowerShell 中,您需要使用调用运算符 (&) 将参数/参数传递给可执行文件。

Taken from this page : Cleaning up IIS Express Sites

取自此页面:清理 IIS Express 站点

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

回答by Iman

  1. Check the Assembly.GetExecutingAssembly().Locationproperty when you are debgging and are stopped at some breakpoint
  2. you will see a location like below path
  1. 在调试时检查Assembly.GetExecutingAssembly().Location属性并在某个断点处停止
  2. 你会看到一个像下面路径这样的位置

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

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)
  1. 所以检查并删除路径下的所有文件夹(在关闭 IIS express 和 VS 后可能有可能)

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

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