Re: Could not load file or assembly 'App_Web...'

"Simpson, Nick" <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <628CA89756065648B4DB6CC967D958B40A14958D@london_mail.eu.ms>
Hi James,

Thanks for your email. We are load-balanced (sticky-IP) and although we
generally have a rule never to use sessions unless absolutely necessary we
might be using them... although i have to say that i have had this error on
my localhost where load balancing doesn't come into it. Will take a look at
this however and appreciate your help.

Nick

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:[email protected]] On Behalf Of James Geall
Sent: 15 February 2007 12:06
To: [email protected]
Subject: Re: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

Hi Nick,

This may not be the problem that you are seeing, but I noticed you mentioned
load balancing. I am assuming that you have the session state being stored
out of process. Do you store anything in the session that is based on a type
that is not precompiled in a dll?

This error can occur if you are doing something similar to the following:

1: Declare enumeration in aspx.cs file - enumeration exists in dll compiled
on the fly by asp.net
2: Stick the enumeration in the session (on machine1)
3: Store the session out of process - cauing the enumeration to be
serialised
4: Get load balanced to another machine (machine2)
5: Session gets loaded onto the other machine(machine2)
6: File not found error occures when the session is deserialised on
(machine2)

this occurs because the randomly generated compiled assembly name is
included in the serialised object which then can't be loaded.  and because
it is load balanced it happens unpredictably and for the lifetime of the
session. The solution is to make sure everything that you put in the session
is in a precompiled dll with a well known name.

Hope this helps
James

On 2/9/07, Simpson, Nick <[email protected]> wrote:
>
> Hi Guys,
>
> From time to time we get a fairly serious exception on our site along
> the lines of the following:
>
> "Could not load file or assembly 'App_Web_gvvevrsq, Version=0.0.0.0,
> Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
> system cannot find the file specified."
>
> The consequences of this are that a great portion of our site simply
> throws this exception (System.IO.FileNotFoundException) and ceases to
> function - bad!
>
> The fix for this is to recompile the application - a real pain in the
> butt if it happens at midnight. Also - although loads of posts out
> there happily suggest different ways of achieving a fix once the
> problem happens, practically none of them are any good on how to stop
> it ever happening in the first place. Links to a few of these posts
> follow:
>
> http://forums.asp.net/thread/1230276.aspx
> http://forums.asp.net/thread/1271201.aspx
>
> Should give you some idea of the sort of confusion that exists out
> there on this. One of the solutions suggested out there was to install
> Visual Studio
> 2005 SP2. I have done so. No fix. The problem still occurs.
>
> The circumstances under which this problem occurs in my particular
> case
> are:
>
> - A non-precompiled release build with pdbs is built to our server.
> - Once the app is running we need to update an aspx or ascx file so we
> copy this to our server.
> - We then sometimes get a "could not load type exception".
> - We take our app off load balancing so no users are on it anymore.
> - We recycle the app to try and clear this but then the "Could not load
> file or assembly.." problem happens.
>
> Any ideas? Some people out there have suggested that this only happens
> for pages that use master pages with nested user controls. Our site
> does this so could be a pointer. However my most recent thoughts have
> turned to getting a
> better understanding of the compilation model in ASP.NET 2.0 and seeing if
> a
> pre-compiled no-pdb release build works via the publish function in VS.NET
> 2005. Maybe this problem never happens during a pre-compiled build.
>
> I read the following article to help me understand the new compilation
> model. Any other articles out there?
> http://odetocode.com/Blogs/scott/archive/2005/11/15/2464.aspx
>
> But i'm not quite yet at understanding how to stop this ever happening
> again. Any ideas?
>
> Nick

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.