开发者

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. The different languages are separated into their own folder and correctly configured in the web.config.

<codeSubDirectories>
    <add directoryName="BasicCode"/>
    <add dir开发者_运维问答ectoryName="CSharpCode"/>
  </codeSubDirectories>

This works fine 95% of the time. In production using 2 load balanced servers I sporadically receive an error message along the lines of:

"Unable to find assembly 'App_SubCode_BasicCode.xxx, Version=0.0.0.0, Culture=netural, PublicKeyToken=null'.

The site is hosted in IIS7 and I think it has something to do with the name of the dll assigned during dynamic compilation. 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?


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.

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜