I've more than one ASP.NET 2.0 web site on IIS 6 and Windows Server 2003. Each site reference some DLLs: design, logic and so on. Each site is on a different ApplicationPool with default configuration about recycling techniques.
我在IIS 6和Windows Server 2003上有多个ASP.NET 2.0网站。每个站点引用一些DLL:设计,逻辑等。每个站点都在不同的ApplicationPool上,其中包含有关回收技术的默认配置。
Every DLL is strong named (not delayed) and has a version that never changes (2.0.0.0), all DLLs are placed in GAC.
每个DLL都是强名称(未延迟),并且具有永不更改的版本(2.0.0.0),所有DLL都放在GAC中。
After I update a DLL in GAC (ie. MyLibrary.dll) that has changed in something (method, classes..) for the use in web-site "A", and after recycling only the "A" application pool, when I try to access to web-site "B" that reference the same DLL I get the common error about that DLL:
我在GAC(即MyLibrary.dll)中更新了一个已经改变了某些东西(方法,类......)的DLL,用于在网站“A”中使用,并且在仅回收“A”应用程序池之后,当我尝试访问引用相同DLL的网站“B”我得到关于该DLL的常见错误:
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
定位的程序集的清单定义与程序集引用不匹配。 (HRESULT异常:0x80131040)
Of course nothing is changed in DLL rather than code, same strongkey, same version, culture. The error disappear over recycling "B" application pool, of course.
当然DLL中没有任何改变,而不是代码,相同的强键,相同的版本,文化。当然,错误会在回收“B”应用程序池中消失。
What can generate a strange, RANDOM (I've to say!), behavior? There's something more, like hashing, that it's used to compare assemblies?
什么可以产生一种奇怪的,随机的(我要说的!),行为?有更多的东西,比如哈希,它用来比较组件?
Addendum
- Perpetualcoder asked me how DLLs are referenced, if with full qualified name, I think it is, here a line of web.config:
Perpetualcoder问我如何引用DLL,如果有完全限定名称,我认为它是,这里是一行web.config:
assembly="MyNamespace.MyComponent, Version=2.0.0.0, Culture=neutral, PublicKeyToken=1234567890ASDFGH"
assembly =“MyNamespace.MyComponent,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 1234567890ASDFGH”
2 个解决方案
#1
I keep repeating myself: don't store files in the GAC unless you absolutely have to. asp.net copies dlls to a temp folder and runs the site from there, it might be checksums mismatch between the loaded dll and the one in the tempfolder.
我不断重复自己:除非你绝对必须,否则不要将文件存储在GAC中。 asp.net将dll复制到临时文件夹并从那里运行该站点,它可能是加载的dll与tempfolder中的dll之间的校验和不匹配。
You should keep your site's dlls local to the sites, in their bin folder. It will give you more flexibility and you don't hurt application B by updating a dll for application A. you also get xcopy deployment for the low price of giving up a bit of diskspace.
您应该将站点的dll保留在站点的本地文件夹中。它将为您提供更大的灵活性,并且您不会通过更新应用程序A的dll来损害应用程序B.您还可以以低廉的价格放弃一些磁盘空间来进行xcopy部署。
#2
Frans, it is a procedure that I understand and it could be a way to deploy of course, but what I don't understand is why even if full qualified name is correct, error comes however. I saw in DLL manifest, there's the hashing algoritm specification. Does ASP.NET perform a hashing compare over DLLs?
Frans,这是我理解的一个程序,它当然可以是一种部署方式,但我不明白为什么即使完全限定名称是正确的,也会出现错误。我在DLL清单中看到,有散列算法规范。 ASP.NET是否对DLL执行散列比较?
What I mean in few words: IIS/ASP.NET finds that DDL "A" doesn't match DLL "B" hash, but triplet "key,culture,version" is the same so why it doesn't just update instead popping out an web.config error?
我的意思是用几句话来说:IIS / ASP.NET发现DDL“A”与DLL“B”哈希不匹配,但三元组“密钥,文化,版本”是相同的,为什么它不只是更新而不是弹出出web.config错误?
#1
I keep repeating myself: don't store files in the GAC unless you absolutely have to. asp.net copies dlls to a temp folder and runs the site from there, it might be checksums mismatch between the loaded dll and the one in the tempfolder.
我不断重复自己:除非你绝对必须,否则不要将文件存储在GAC中。 asp.net将dll复制到临时文件夹并从那里运行该站点,它可能是加载的dll与tempfolder中的dll之间的校验和不匹配。
You should keep your site's dlls local to the sites, in their bin folder. It will give you more flexibility and you don't hurt application B by updating a dll for application A. you also get xcopy deployment for the low price of giving up a bit of diskspace.
您应该将站点的dll保留在站点的本地文件夹中。它将为您提供更大的灵活性,并且您不会通过更新应用程序A的dll来损害应用程序B.您还可以以低廉的价格放弃一些磁盘空间来进行xcopy部署。
#2
Frans, it is a procedure that I understand and it could be a way to deploy of course, but what I don't understand is why even if full qualified name is correct, error comes however. I saw in DLL manifest, there's the hashing algoritm specification. Does ASP.NET perform a hashing compare over DLLs?
Frans,这是我理解的一个程序,它当然可以是一种部署方式,但我不明白为什么即使完全限定名称是正确的,也会出现错误。我在DLL清单中看到,有散列算法规范。 ASP.NET是否对DLL执行散列比较?
What I mean in few words: IIS/ASP.NET finds that DDL "A" doesn't match DLL "B" hash, but triplet "key,culture,version" is the same so why it doesn't just update instead popping out an web.config error?
我的意思是用几句话来说:IIS / ASP.NET发现DDL“A”与DLL“B”哈希不匹配,但三元组“密钥,文化,版本”是相同的,为什么它不只是更新而不是弹出出web.config错误?