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

"Pardee, Roy" <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <[email protected]>
If the reference was set in vs.net 2003, wouldn't a v1.1 proxy dll be
generated?  Maybe that's the problem?

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:[email protected]] On Behalf Of Mark Kucera
Sent: Monday, February 19, 2007 5:14 AM
To: [email protected]
Subject: Re: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

No, I wouldn't think a .NET 1.1 web service would matter, because
ultimately a web service is just a soap call where VS.NET has abstracted
away the details. 

Mark


-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:[email protected]] On Behalf Of Simpson, Nick
Sent: Monday, February 19, 2007 6:03 AM
To: [email protected]
Subject: Re: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

Mark - does a .NET 1.1. web service count as a referenced assembly that
might cause this problem? I know for a fact that we reference a .NET 1.1
web service on the page that seems to be the root of our problem.

Jon - what was the logic behind dropping in the web services DLL? Were
you getting this problem on a page that referenced a web service or did
you have some other reasoning behind this?

Nick

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

I've experienced this too. For a quick fix, I dropped the 1.1
Microsoft.Web.Services.dll in the folder where the 1.1 assembly was
located.
Cleaned up the problem for me.

Jon

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:[email protected]] On Behalf Of Mark Kucera
Sent: Thursday, February 15, 2007 11:16 AM
To: [email protected]
Subject: Re: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

Ian,

Do you have any 1.1 assemblies being referenced from your 2.0 app?  I
strongly suggest you take a look at that first.  I am 99.9% convinced
that was what fixed the problem for us.  I would be shocked if your
situation was different. The symptoms and resolutions steps you (and
Nick) mention match up 100% with what we were experiencing, and this
problem has completely vanished after migrating a single assembly from
1.1 to 2.0.
(and note too that the assembly I migrated was not listed in any error
messages, it just happened to be the only one that hadn't yet been
upgraded).  Like you, we're using precompiled code w/ the Web
Application Project type.

Good Luck
Mark

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

We precompile our code using the Web Application Project project type.
MS
actually slapped my hand a bit for this and said this may have something
to do with the problem <that's your q scott;)>.

I'm not sure if your deployment method would work for us.  As it stands,
I can IISReset and clear temp files, have no new files deployed from
that point, and the error creeps up again.

Thanks for your feedback.  If I receive more information I'll be sure to
share.

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:[email protected]] On Behalf Of Simpson, Nick
Sent: Thursday, February 15, 2007 9:17 AM
To: [email protected]
Subject: Re: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

Hi Ian,

Our current way of avoiding this error happening is not to allow any
.ascx, .aspx, .cs, or other ASP.NET files to be deployed to the live
server except during a full build and when the site has been stopped
with "iisreset -stop"
before we copy any files over. So far in following this practice this
problem has not happened to us. Not ideal but so far it's done the job.

I have found that when this did happen on our live server it is
sometimes preceeded by a "Could not load type" error which then either
(a) immediately goes on to become a "Could not load file or assembly
error" or (b) eventually does this when the app is recycled.

One of my theories is that if i copy an .ascx file to my site folder
structure whilst a page with that user control is being requested by a
user the problem can occur. I think this can sometimes cause a "Could
not load type" exception and then the compiler gets it's knickers in a
twist and something more dramatic happens afterwards. In our case the
particular page that exhibits the "Could not load type" exception has a
Master page with nested user controls, and other user controls that are
dynamically loaded, and references a web service, and maybe also
references a .NET 1.1 DLL, so there are plenty of factors that could be
involved in this. Urk.

One thing i was wondering is if anyone out there precompiles their code
and whether they have any problems? If so please let me know. I am just
wondering if precompilation might solve this completely somehow.

Nick

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


I've also had this error.  We have a load-balanced environment, and
store nothing in session state.  We've narrowed the problem down to a
single user control (nested) but we're unable to detect the problem
still (the control looks fine).  I opened a case with Microsoft.  They
recommended a hot fix for this issue, which did not fix it.  They then
recommended I switch to debug mode, clear my temp files for .Net, and
when the error occurred again to send them both my /bin contents and
.net temp file contents so they could look into it further.  They did
not respond to this data.  In my latest attempt they told me to change
the batch attribute of the compilation node in my web.config to "false"
(default is "true").  This has not helped either.

To alleviate the occurrence I have a script which does an IISReset and
clears the .Net temp files on all servers in the farm.  Now what is
funny is the problem appears to grow.  It starts on one server, and
"spreads."
I'm
sure this is a timing issue since the last IISReset of course.

We have not resolved our problem to date.  If you find a fix other than
what I've listed here, please share your experience.

Thanks,
Ian Suttle
http://www.iansuttle.com

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:[email protected]] On Behalf Of Mark Kucera
Sent: Thursday, February 15, 2007 5:45 AM
To: [email protected]
Subject: Re: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

Nick,

FWIW, in our environment where we had the same issue you report, we were
NOT in a load balanced environment, and also like you, I was
experiencing the error on localhost as well as production.

-Mark

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:[email protected]] On Behalf Of Simpson, Nick
Sent: Thursday, February 15, 2007 7:20 AM
To: [email protected]
Subject: Re: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

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(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
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.