Discussion:
Could not load file or assembly 'App_Web...'
Simpson, Nick
2007-02-09 15:31:46 UTC
Permalink
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
Simpson, Nick
2007-02-09 16:12:30 UTC
Permalink
One error in my post. I installed Visual Studio 2005 SP1 not SP2.

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Simpson, Nick
Sent: 09 February 2007 15:32
To: DOTNET-***@DISCUSS.DEVELOP.COM
Subject: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

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® http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Mark Kucera
2007-02-09 19:15:55 UTC
Permalink
Simpson, Nick
2007-02-14 16:21:36 UTC
Permalink
Thanks Mark. I read somewhere that the hotfix for KBID 915782 was part of
VS2005 SP1. I installed VS2005 SP1 and it didn't fix the problem.

Interesting about the reference to 1.x assemblies. We reference a few third
party assemblies and a few web services. Do web services count? Also - how
can you tell in a really easy non-programmatic way what version of .NET an
assembly was built in? I'm sure this is easy, i just don't know. I used
Reflector but couldn't see this information, ditto for file system
properties.

Nick

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Mark Kucera
Sent: 09 February 2007 19:16
To: DOTNET-***@DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

We had this same problem. And it was always a real pain. The problem would
always occur at the most inopportune times, and often we weren't able to
recompile and deploy because it would be publishing code that wasn't
finished yet. We actually figured out that you can basically stop the site,
and go into the temporary asp.net files
c:\windows\microsoft.net\framework\.... and delete the cache and then the
site would come back up and work again for a couple days or hours. There was
no logic to when it would die the next time. MS has a KB that is supposed
to fix this error...

http://support.microsoft.com/kb/915782/en-us

however I had read on several forum posts about people who installed this
and still experienced the problem afterwards. We installed this Hotfix and
continued to experience the problem.

Ironically I posted a message to this forum a couple months ago w/ this
problem and 1 user wrote back to check your application and see if you might
be referencing any 1.x assemblies in your 2.x application. Sure enough I
had 1 1.1 assembly that was being referenced, and after I rewrote it into
2.0 (Thank You Reflector.exe) the problem went away and hasn't happened
since. I'd urge you to take a look and see if that might be your problem as
well.

Good Luck!
MK


-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Simpson, Nick
Sent: Friday, February 09, 2007 11:13 AM
To: DOTNET-***@DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

One error in my post. I installed Visual Studio 2005 SP1 not SP2.

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Simpson, Nick
Sent: 09 February 2007 15:32
To: DOTNET-***@DISCUSS.DEVELOP.COM
Subject: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

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(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
Mark Kucera
2007-02-14 19:54:50 UTC
Permalink
James Geall
2007-02-15 12:05:41 UTC
Permalink
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 <***@musicsales.co.uk> 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® http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Simpson, Nick
2007-02-15 12:19:44 UTC
Permalink
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of James Geall
Sent: 15 February 2007 12:06
To: DOTNET-***@DISCUSS.DEVELOP.COM
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 <***@musicsales.co.uk> 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
Mark Kucera
2007-02-15 13:45:13 UTC
Permalink
Ian Suttle
2007-02-15 17:01:02 UTC
Permalink
Simpson, Nick
2007-02-15 17:17:04 UTC
Permalink
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Ian Suttle
Sent: 15 February 2007 17:01
To: DOTNET-***@DISCUSS.DEVELOP.COM
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Mark Kucera
Sent: Thursday, February 15, 2007 5:45 AM
To: DOTNET-***@DISCUSS.DEVELOP.COM
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Simpson, Nick
Sent: Thursday, February 15, 2007 7:20 AM
To: DOTNET-***@DISCUSS.DEVELOP.COM
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of James Geall
Sent: 15 February 2007 12:06
To: DOTNET-***@DISCUSS.DEVELOP.COM
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 <***@musicsales.co.uk> 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
Ian Suttle
2007-02-15 17:36:19 UTC
Permalink
Mark Kucera
2007-02-15 18:16:29 UTC
Permalink
Ian Suttle
2007-02-15 18:19:26 UTC
Permalink
Jon Finley
2007-02-15 18:27:03 UTC
Permalink
Simpson, Nick
2007-02-19 11:02:34 UTC
Permalink
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Jon Finley
Sent: 15 February 2007 18:27
To: DOTNET-***@DISCUSS.DEVELOP.COM
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Mark Kucera
Sent: Thursday, February 15, 2007 11:16 AM
To: DOTNET-***@DISCUSS.DEVELOP.COM
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Ian Suttle
Sent: Thursday, February 15, 2007 12:36 PM
To: DOTNET-***@DISCUSS.DEVELOP.COM
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Simpson, Nick
Sent: Thursday, February 15, 2007 9:17 AM
To: DOTNET-***@DISCUSS.DEVELOP.COM
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Ian Suttle
Sent: 15 February 2007 17:01
To: DOTNET-***@DISCUSS.DEVELOP.COM
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Mark Kucera
Sent: Thursday, February 15, 2007 5:45 AM
To: DOTNET-***@DISCUSS.DEVELOP.COM
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Simpson, Nick
Sent: Thursday, February 15, 2007 7:20 AM
To: DOTNET-***@DISCUSS.DEVELOP.COM
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of James Geall
Sent: 15 February 2007 12:06
To: DOTNET-***@DISCUSS.DEVELOP.COM
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 <***@musicsales.co.uk> 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
Mark Kucera
2007-02-19 13:13:31 UTC
Permalink
Jon Finley
2007-02-20 14:29:37 UTC
Permalink
Pardee, Roy
2007-02-20 16:07:31 UTC
Permalink
Simpson, Nick
2007-02-22 16:36:16 UTC
Permalink
Wierd. Have just checked the KBID article below and it looks like it exactly
describes the problem i get, much more so than it did in the past. Hmmmm.

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Mark Kucera
Sent: 09 February 2007 19:16
To: DOTNET-***@DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] Could not load file or assembly 'App_Web...'


We had this same problem. And it was always a real pain. The problem would
always occur at the most inopportune times, and often we weren't able to
recompile and deploy because it would be publishing code that wasn't
finished yet. We actually figured out that you can basically stop the site,
and go into the temporary asp.net files
c:\windows\microsoft.net\framework\.... and delete the cache and then the
site would come back up and work again for a couple days or hours. There was
no logic to when it would die the next time. MS has a KB that is supposed
to fix this error...

http://support.microsoft.com/kb/915782/en-us

however I had read on several forum posts about people who installed this
and still experienced the problem afterwards. We installed this Hotfix and
continued to experience the problem.

Ironically I posted a message to this forum a couple months ago w/ this
problem and 1 user wrote back to check your application and see if you might
be referencing any 1.x assemblies in your 2.x application. Sure enough I
had 1 1.1 assembly that was being referenced, and after I rewrote it into
2.0 (Thank You Reflector.exe) the problem went away and hasn't happened
since. I'd urge you to take a look and see if that might be your problem as
well.

Good Luck!
MK

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Simpson, Nick
Sent: Friday, February 09, 2007 11:13 AM
To: DOTNET-***@DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

One error in my post. I installed Visual Studio 2005 SP1 not SP2.

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Simpson, Nick
Sent: 09 February 2007 15:32
To: DOTNET-***@DISCUSS.DEVELOP.COM
Subject: [DOTNET-WEB] Could not load file or assembly 'App_Web...'

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
Continue reading on narkive:
Loading...