[英]Unable to find Assembly error when using <codeSubDirectories> in web.config
I have a web site that uses the both c# and vb.net in the app_code section. 我有一个在app_code部分中同时使用c#和vb.net的网站。 The different languages are separated into their own folder and correctly configured in the web.config.
不同的语言被分为各自的文件夹,并在web.config中正确配置。
<codeSubDirectories>
<add directoryName="BasicCode"/>
<add directoryName="CSharpCode"/>
</codeSubDirectories>
This works fine 95% of the time. 95%的时间都可以正常工作。 In production using 2 load balanced servers I sporadically receive an error message along the lines of:
在使用2个负载平衡服务器的生产环境中,我偶尔会收到以下错误消息:
"Unable to find assembly 'App_SubCode_BasicCode.xxx, Version=0.0.0.0, Culture=netural, PublicKeyToken=null'.
“无法找到程序集'App_SubCode_BasicCode.xxx,版本= 0.0.0.0,文化=网络,PublicKeyToken =空”。
The site is hosted in IIS7 and I think it has something to do with the name of the dll assigned during dynamic compilation. 该站点托管在IIS7中,我认为它与动态编译期间分配的dll名称有关。 I do not see this problem in a single server environment.
我在单个服务器环境中没有看到此问题。 Could this be because when the session is balanced to the second server the dynamic compiled dll name is different?
可能是因为当会话与第二台服务器平衡时,动态编译的dll名称不同吗?
It's entirely possible that the two different servers are generating different names for the dynamic assemblies; 完全有可能两个不同的服务器为动态程序集生成不同的名称。 in fact I think that's probably a dead cert.
实际上,我认为那可能是一个死证书。
The question, however, is why is one server producing an assembly name that the other one is then trying to use? 但是,问题是,为什么一台服务器生成另一个然后要使用的程序集名称? With a bog standard load balanced Asp.Net site you'd never see this.
使用沼泽标准负载平衡的Asp.Net网站,您将永远不会看到这一点。
Are there any types defined in the website code that then get serialised (either to viewstate or to a shared session state)? 网站代码中是否定义了任何类型然后将其序列化(查看状态或共享会话状态)?
If so, then this could be the problem - one server dehydrates an object from one dynamic assembly, and the other tries and fails to hydrate it because it's version is a different name. 如果是这样,则可能是问题所在-一台服务器从一个动态程序集中对一个对象进行脱水处理,另一台服务器尝试对该对象进行脱水处理,因为该版本的名称不同而无法进行脱水。
That said, I think I'd expect to see a TypeLoadException rather than one relating to Assembly Loading if that were the case. 就是说,我想我希望看到的是TypeLoadException,而不是与程序集加载有关的类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.