开发者

How to debug Assembly Load - ConfigurationErrorsException

开发者 https://www.devze.com 2023-03-06 02:20 出处:网络
I\'ve got an application that runs fine locally, but when deployed I\'m seeing the error: Exception information:

I've got an application that runs fine locally, but when deployed I'm seeing the error:

Exception information: 
    Exception type: ConfigurationErrorsException 
    Exception message: Could not load file or assembly 'FluentMigrator.Runner' or one of its dependencies. An attempt was made to load a program with an incorrect format.
    at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolea开发者_如何学Cn starDirective)
    at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
    at System.Web.Configuration.AssemblyInfo.get_AssemblyInternal()
    at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
    at System.Web.Compilation.BuildManager.CallPreStartInitMethods()
    at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

I've tried viewing the assembly bindings log through the Assembly Binding Log Viewer, but even with that turned on I'm getting no more information than the above stack trace, the log seems to stay empty. The assembly that it's complaining about is present and on the face of it has all of it's dependant assemblies present. What else can I do to debug what wrong on my server?


This error is related to architecture mismatch, i.e. your binaries probably expect to run in x86 process, but IIS runs these in x64 process (or vice versa). This is configurable in App Pool settings.

To debug the issue, you could try the following: 1) Enable fusion logging ( How to enable assembly bind failure logging (Fusion) in .NET

2) Using windows debugger (WinDbg) with loader snaps. Please see here how to set it up. http://www.microsoft.com/msj/0999/hood/hood0999.aspx

Also when in WinDbg catch managed exception with sxeclr command When you hit ConfigurationErrorsException, you should run .loadby sos clr command, then !pe - this should display more details on the exception. At the same time, loader snaps should show which dll is having loading problems. You'd need to run your IIS worker process (w3wp.exe) under WinDBG. You should use gflags to configure that. Usually 2) would help with C++/CLI assemblies.

0

精彩评论

暂无评论...
验证码 换一张
取 消