我如何在.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
其他回答
您可以以管理员身份运行此Powershell脚本来启用FL:
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name ForceLog -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogFailures -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogResourceBinds -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogPath -Value 'C:\FusionLog\' -Type String
mkdir C:\FusionLog -Force
这个要禁用:
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name ForceLog
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogFailures
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogResourceBinds
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogPath
将下列值添加到
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\)
确保在文件夹名称后包含反斜杠,并且文件夹存在。
您需要重新启动正在运行的程序,以强制它读取这些注册表设置。
顺便说一下,不要忘记在不需要的时候关闭融合日志记录。
对于那些有点懒的人,我建议当你想要启用它时,把它作为一个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
我通常使用Fusion日志查看器(从Visual Studio命令提示符或从开始菜单中的Fusion日志查看器中的Fuslogvw.exe) -我的标准设置是:
以管理员身份打开Fusion Log Viewer 点击设置 选中“启用自定义日志路径”复选框 输入要写入日志的位置,例如c:\FusionLogs(注意:请确保您已经在文件系统中创建了此文件夹)。 确保打开了正确的日志级别(我有时只是选择“日志全部绑定到磁盘”,只是为了确保事情正常工作) 单击OK 将日志位置选项设置为自定义
一旦你完成了,记得关闭登录!
(我刚刚就一个类似的问题发表了这篇文章——我认为这也与此相关。)
推荐文章
- 何时处理CancellationTokenSource?
- 如何获取正在执行的程序集版本?
- AutoMapper vs valueinjector
- 为什么控制台不。Writeline,控制台。在Visual Studio Express中编写工作?
- 什么是.NET程序集?
- 字符串不能识别为有效的日期时间“格式dd/MM/yyyy”
- 函数应该返回空对象还是空对象?
- 如何转换日期时间?将日期时间
- 如何在c#中连接列表?
- 在c#中引用类型变量的“ref”的用途是什么?
- 防止在ASP中缓存。NET MVC中使用属性的特定操作
- 转换为值类型'Int32'失败,因为物化值为空
- c#中有任何连接字符串解析器吗?
- 在Linq中转换int到字符串到实体的问题
- 是否可以动态编译和执行c#代码片段?