.NET DLL dependency of same file
I upgraded one of our websites and were greated by this error:
=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = <assembly>, Version=2.0.42.64, Culture=neutral, PublicKeyToken=c445f6f924945bd1
(Fully-specified)
LOG: Appbase = file:///E:/Web/
LOG: Initial PrivatePath = E:\Web\bin
Calling assembly : <assembly>, Version=2.0.42.67, Culture=neutral, PublicKeyToken=c445f6f924945bd1.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\Web\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: <assembly>, Version=2.0.42.64, Culture=neutral, PublicKeyToken=c445f6f924945bd1
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/5ee48cb7/31fcfc81/<assembly>.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/5ee48cb7/31fcfc81/<assembly>/<assembly>.DLL.
LOG: Attempting download of new URL file:///E:/Web/bin/<assembly>.DLL.
WRN: Comparing the assembly name resulted in the开发者_如何学编程 mismatch: Revision Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Where <assembly>
is the name of the assemble.
If i read this correctly the assemble(.67) is trying to load itself, but the previous(.64) and is failing because the obviously a file can't have 2 versions...
What can cause this problem? Is it my configuration or the assembly's compilation that is wrong?
I've found the reason for the error message now and posting it here so it might help others.
There were two assemblies with cyclic dependency, where one of them didn't have strict revision check:
a1(.67) -> a2(.11) -> a1(.64)
Where a1
and a2
are the assembly names and the number in the brackets are the revisions.
So what really happens is that the first assembly is loading an old assembly, which in turn tries to load the old revision of assembly one. Then the error message will tell you that a1(.67)
tries to load a1(.64)
, and skips the whole chain of loading assemblies.
To help with debugging of this a1
should be strict about what revision of a2
that should be loaded. Then the error message will tell you that a2
is old.
I've seen this once or twice when I've had objects in the cache or session and I've built a new version of the assembly and just copied it over the original while the app is still running. The fix was to restart the ASP.NET app, and delete the Temporary ASP.NET Files.
精彩评论