我如何在.NET中启用程序集绑定失败日志记录(融合)?
当前回答
对于那些有点懒的人,我建议当你想要启用它时,把它作为一个bat文件运行:
reg add "HKLM\Software\Microsoft\Fusion" /v EnableLog /t REG_DWORD /d 1 /f
reg add "HKLM\Software\Microsoft\Fusion" /v ForceLog /t REG_DWORD /d 1 /f
reg add "HKLM\Software\Microsoft\Fusion" /v LogFailures /t REG_DWORD /d 1 /f
reg add "HKLM\Software\Microsoft\Fusion" /v LogResourceBinds /t REG_DWORD /d 1 /f
reg add "HKLM\Software\Microsoft\Fusion" /v LogPath /t REG_SZ /d C:\FusionLog\
if not exist "C:\FusionLog\" mkdir C:\FusionLog
其他回答
以防你想知道FusionLog.exe -的位置 你知道你有,但你找不到?在过去的几年里,我一遍又一遍地寻找FUSLOVW。在迁移到。net 4.5之后,FUSION LOG的版本数量激增。 她是可以在你的磁盘上找到它的地方,这取决于你安装的软件:
C:\Program Files (x86)\Microsoft sdk \Windows\v8.0A\bin\NETFX 4.0 Tools\x64
C:\Program Files (x86)\Microsoft sdk \Windows\v7.0A\Bin\x64
C:\Program Files (x86)\Microsoft sdk \Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64
C:\Program Files (x86)\Microsoft sdk \Windows\v8.0A\bin\NETFX 4.0工具
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
C:\Program Files (x86)\Microsoft sdk \Windows\v7.0A\Bin
您也可以通过ETW/xperf通过GUID 763FD754-7086-4DFE-95EB-C01A46FAF4CA和FusionKeyword关键字(0x4)打开dotnetruntimeprivate提供者(Microsoft-Windows-DotNETRuntimePrivate)来激活Fusion日志。
@echo off
echo Press a key when ready to start...
pause
echo .
echo ...Capturing...
echo .
"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\xperf.exe" -on PROC_THREAD+LOADER+PROFILE -stackwalk Profile -buffersize 1024 -MaxFile 2048 -FileMode Circular -f Kernel.etl
"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\xperf.exe" -start ClrSession -on Microsoft-Windows-DotNETRuntime:0x8118:0x5:'stack'+763FD754-7086-4DFE-95EB-C01A46FAF4CA:0x4:0x5 -f clr.etl -buffersize 1024
echo Press a key when you want to stop...
pause
pause
echo .
echo ...Stopping...
echo .
"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\xperf.exe" -start ClrRundownSession -on Microsoft-Windows-DotNETRuntime:0x8118:0x5:'stack'+Microsoft-Windows-DotNETRuntimeRundown:0x118:0x5:'stack' -f clr_DCend.etl -buffersize 1024
timeout /t 15
set XPERF_CreateNGenPdbs=1
"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\xperf.exe" -stop ClrSession ClrRundownSession
"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\xperf.exe" -stop
"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\xperf.exe" -merge kernel.etl clr.etl clr_DCend.etl Result.etl -compress
del kernel.etl
del clr.etl
del clr_DCend.etl
当你现在在PerfView中打开ETL文件并在事件表下查看时,你可以找到Fusion数据:
将下列值添加到
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion Add: DWORD ForceLog set value to 1 DWORD LogFailures set value to 1 DWORD LogResourceBinds set value to 1 DWORD EnableLog set value to 1 String LogPath set value to folder for logs (e.g. C:\FusionLog\)
确保在文件夹名称后包含反斜杠,并且文件夹存在。
您需要重新启动正在运行的程序,以强制它读取这些注册表设置。
顺便说一下,不要忘记在不需要的时候关闭融合日志记录。
设置以下注册表值:
(微软HKEY_LOCAL_MACHINE \ SOFTWARE \ \融合!EnableLog] (DWORD)到1
若要禁用,请设置为0或删除该值。
[edit]:将以下文本保存为文件,如“FusionEnableLog”。注册, Windows注册表编辑器格式:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion]
"EnableLog"=dword:00000001
然后从windows资源管理器运行该文件,并忽略有关可能损坏的警告。
融合日志设置查看器更改脚本是做到这一点的最好方法。
在ASP。NET中,有时要使它正确工作是很棘手的。这个脚本工作得很好,也被列入了Scott Hanselman的Power Tool列表。我个人已经使用它很多年了,它从来没有让我失望过。
推荐文章
- 实体框架核心:在上一个操作完成之前,在此上下文中开始的第二个操作
- 如何为构造函数定制Visual Studio的私有字段生成快捷方式?
- 为什么Visual Studio 2015/2017/2019测试运行器没有发现我的xUnit v2测试
- 如何使用JSON确保字符串是有效的JSON。网
- AppSettings从.config文件中获取值
- 通过HttpClient向REST API发布一个空体
- 如何检查IEnumerable是否为空或空?
- 自动化invokerrequired代码模式
- 没有ListBox。SelectionMode="None",是否有其他方法禁用列表框中的选择?
- 在c#代码中设置WPF文本框的背景颜色
- 在c#中,什么是单子?
- c#和Java中的泛型有什么不同?和模板在c++ ?
- c#线程安全快速(est)计数器
- 如何将此foreach代码转换为Parallel.ForEach?
- 如何在iis7应用程序池中设置。net Framework 4.5版本