C# 文件 security.config.cch 对 CLR 有什么作用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/533824/
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
What does the file security.config.cch do with the CLR?
提问by Dave Moore
I've been experiencing nasty lockups while debugging under VS2008, SP1 on my machine. I was running ProcMon.exe to try and determine what is going on. One thing I see is 100s or 1000s of repeated reads + writes to a file called security.config.cch and security.config.cch.new.
在我的机器上在 VS2008 SP1 下调试时,我遇到了令人讨厌的锁定。我正在运行 ProcMon.exe 来尝试确定发生了什么。我看到的一件事是对名为 security.config.cch 和 security.config.cch.new 的文件进行 100 或 1000 次重复读取 + 写入。
What are these files? Why would my application need to read + write repeatedly to this file?
这些文件是什么?为什么我的应用程序需要反复读+写这个文件?
Thanks, Dave
谢谢,戴夫
Example :
例子 :
2:18:14.1421944 PM App.vshost.exe 1152 ReadFile C:\Documents and Settings\myuser\Application Data\Microsoft\CLR Security Config\v2.0.50727.42\security.config.cch SUCCESS Offset: 170,397, Length: 208 2:18:14.1422854 PM App.vshost.exe 1152 ReadFile C:\Documents and Settings\myuser\Application Data\Microsoft\CLR Security Config\v2.0.50727.42\security.config.cch SUCCESS Offset: 170,605, Length: 224 2:18:14.1423824 PM App.vshost.exe 1152 WriteFile C:\Documents and Settings\myuser\Application Data\Microsoft\CLR Security Config\v2.0.50727.42\security.config.cch.new SUCCESS Offset: 206,817, Length: 208 2:18:14.1424843 PM App.vshost.exe 1152 WriteFile C:\Documents and Settings\myuser\Application Data\Microsoft\CLR Security Config\v2.0.50727.42\security.config.cch.new SUCCESS Offset: 207,025, Length: 224 2:18:14.1425788 PM App.vshost.exe 1152 WriteFile C:\Documents and Settings\myuser\Application Data\Microsoft\CLR Security Config\v2.0.50727.42\security.config.cch.new SUCCESS Offset: 207,249, Length: 12 2:18:14.1426746 PM App.vshost.exe 1152 ReadFile C:\Documents and Settings\myuser\Application Data\Microsoft\CLR Security Config\v2.0.50727.42\security.config.cch SUCCESS Offset: 170,841, Length: 220 2:18:14.1427679 PM App.vshost.exe 1152 ReadFile C:\Documents and Settings\myuser\Application Data\Microsoft\CLR Security Config\v2.0.50727.42\security.config.cch SUCCESS Offset: 171,061, Length: 224
采纳答案by CraigTP
security.config.cch
files, and variations of them (security.config.cch.new
, security.config.cch.[random numbers]
etc.) are security resolution cache files.
security.config.cch
文件,并把它们(的变化security.config.cch.new
,security.config.cch.[random numbers]
等等)是安全的第缓存文件。
These files are essentially a cache of the CAS (Code Access Security)demands of your application's code. They allow the in-built security system of the CLR to resolve the security demands of your code slightly quicker.
这些文件本质上是应用程序代码的CAS(代码访问安全)需求的缓存。它们允许 CLR 的内置安全系统稍微更快地解决代码的安全需求。
You can safely delete these files, and this will result in your application's initial performance next time around to be slightly slower, however, the CLR security sub-system will eventually re-generate these files.
您可以安全地删除这些文件,这将导致您的应用程序下次的初始性能稍微变慢,但是,CLR 安全子系统最终会重新生成这些文件。
There was a known issue that could arise from this process, "FIX: Error message when you try to run a Web application that was built by using the .NET Framework 2.0: "Overwhelming changes have occurred"however, this applies to .NET Framework 2.0 and may or may not still apply with .NET Framework 3.5 SP1 (which you're using with VS2008 SP1).
此过程可能会出现一个已知问题,“修复:尝试运行使用 .NET Framework 2.0 构建的 Web 应用程序时出现错误消息:”发生了巨大的变化”但是,这适用于 .NET Framework 2.0 并且可能会或可能不会适用于 .NET Framework 3.5 SP1(您正在使用 VS2008 SP1)。
It's perfectly normal for there to be many reads/writes to these files, however, if the reads/writes seem excessive and to the point where you're experiencing lock-ups I would look into either reviewing your code (assuming you have many calls to demand specific security actionsor equivalent), or examining the configuration of your Runtime Security Policyas set within the .NET Framework Configuration Tool (Mscorcfg.msc).
对这些文件进行多次读取/写入是完全正常的,但是,如果读取/写入看起来过多并且到了您遇到锁定的地步,我会考虑查看您的代码(假设您有很多调用对需要有明确的安全操作或同等学历),或检查你的配置运行库安全策略为内集.NET Framework配置工具(Mscorcfg.msc) 。