我如何在.NET中启用程序集绑定失败日志记录(融合)?


当前回答

如果你已经启用了日志记录,在Windows 7 64位上仍然会得到这个错误,在iis7.5中尝试一下:

创建一个新的应用程序池 进入该应用池的高级设置 将启用32位应用程序设置为True 让您的web应用程序使用这个新池

其他回答

对于那些有点懒的人,我建议当你想要启用它时,把它作为一个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

设置以下注册表值:

(微软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列表。我个人已经使用它很多年了,它从来没有让我失望过。

在我的例子中,帮助键入小写的磁盘名称

错误- C:\someFolder

正确- c:\someFolder

您也可以通过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数据: