Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Assembly not found when in GAC

Reply
Thread Tools

Assembly not found when in GAC

 
 
Web Team @ Borough of Poole
Guest
Posts: n/a
 
      08-19-2005
Hi All,

I recently moved our assembly which stores our 'common' code into the
GAC. I then moved all copies of this assembly out of the /bin folders,
restarted IIS. I get the error below.

This is the first time I have put something into the GAC, from what I
read, the GAC is probed first, before looking to application folders,
so surely my code should load from the GAC, if its not in the app
folders? Or, is the error due to the way we have referenced the
libraries when building (Referenced by project).

Any help/advice on this will be appreciated.

Thanks,

Simon.



Server Error in '/netapps' Application.
--------------------------------------------------------------------------------

File or assembly name OldInfra, or one of its dependencies, was not
found.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: File or assembly
name OldInfra, or one of its dependencies, was not found.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.


Assembly Load Trace: The following information can be helpful to
determine why the assembly 'OldInfra' could not be loaded.


=== Pre-bind state information ===
LOG: DisplayName = OldInfra, Version=1.0.2056.26999, Culture=neutral,
PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///D:/Introot/netapps
LOG: Initial PrivatePath = bin
Calling assembly : EmpPhotos, Version=1.0.2056.26999, Culture=neutral,
PublicKeyToken=null.
===

LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: Post-policy reference: OldInfra, Version=1.0.2056.26999,
Culture=neutral, PublicKeyToken=null
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/netapps/54285709/c2671f29/OldInfra.DLL.
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/netapps/54285709/c2671f29/OldInfra/OldInfra.DLL.
LOG: Attempting download of new URL
file:///D:/Introot/netapps/bin/OldInfra.DLL.
LOG: Attempting download of new URL
file:///D:/Introot/netapps/bin/OldInfra/OldInfra.DLL.
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/netapps/54285709/c2671f29/OldInfra.EXE.
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/netapps/54285709/c2671f29/OldInfra/OldInfra.EXE.
LOG: Attempting download of new URL
file:///D:/Introot/netapps/bin/OldInfra.EXE.
LOG: Attempting download of new URL
file:///D:/Introot/netapps/bin/OldInfra/OldInfra.EXE.



Stack Trace:


[FileNotFoundException: File or assembly name OldInfra, or one of its
dependencies, was not found.]
EmpPhotos.stats.Page_Load(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
ASP.NET Version:1.1.4322.2032

 
Reply With Quote
 
 
 
 
dennis.mulder@noemail.nospam
Guest
Posts: n/a
 
      08-19-2005
Hey,

Is your DLL dependent on another assemly (not in the GAC)?

Dennis

> Hi All,
>
> I recently moved our assembly which stores our 'common' code into the
> GAC. I then moved all copies of this assembly out of the /bin folders,
> restarted IIS. I get the error below.
>
> This is the first time I have put something into the GAC, from what I
> read, the GAC is probed first, before looking to application folders,
> so surely my code should load from the GAC, if its not in the app
> folders? Or, is the error due to the way we have referenced the
> libraries when building (Referenced by project).
>
> Any help/advice on this will be appreciated.
>
> Thanks,
>
> Simon.
>
> Server Error in '/netapps' Application.
> ----------------------------------------------------------------------
> ----------
> File or assembly name OldInfra, or one of its dependencies, was not
> found.
> Description: An unhandled exception occurred during the execution of
> the current web request. Please review the stack trace for more
> information about the error and where it originated in the code.
> Exception Details: System.IO.FileNotFoundException: File or assembly
> name OldInfra, or one of its dependencies, was not found.
>
> Source Error:
>
> An unhandled exception was generated during the execution of the
> current web request. Information regarding the origin and location of
> the exception can be identified using the exception stack trace below.
>
> Assembly Load Trace: The following information can be helpful to
> determine why the assembly 'OldInfra' could not be loaded.
>
> === Pre-bind state information ===
> LOG: DisplayName = OldInfra, Version=1.0.2056.26999, Culture=neutral,
> PublicKeyToken=null
> (Fully-specified)
> LOG: Appbase = file:///D:/Introot/netapps
> LOG: Initial PrivatePath = bin
> Calling assembly : EmpPhotos, Version=1.0.2056.26999, Culture=neutral,
> PublicKeyToken=null.
> ===
> LOG: Policy not being applied to reference at this time (private,
> custom, partial, or location-based assembly bind).
> LOG: Post-policy reference: OldInfra, Version=1.0.2056.26999,
> Culture=neutral, PublicKeyToken=null
> LOG: Attempting download of new URL
> file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> Files/netapps/54285709/c2671f29/OldInfra.DLL.
> LOG: Attempting download of new URL
> file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> Files/netapps/54285709/c2671f29/OldInfra/OldInfra.DLL.
> LOG: Attempting download of new URL
> file:///D:/Introot/netapps/bin/OldInfra.DLL.
> LOG: Attempting download of new URL
> file:///D:/Introot/netapps/bin/OldInfra/OldInfra.DLL.
> LOG: Attempting download of new URL
> file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> Files/netapps/54285709/c2671f29/OldInfra.EXE.
> LOG: Attempting download of new URL
> file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> Files/netapps/54285709/c2671f29/OldInfra/OldInfra.EXE.
> LOG: Attempting download of new URL
> file:///D:/Introot/netapps/bin/OldInfra.EXE.
> LOG: Attempting download of new URL
> file:///D:/Introot/netapps/bin/OldInfra/OldInfra.EXE.
> Stack Trace:
>
> [FileNotFoundException: File or assembly name OldInfra, or one of its
> dependencies, was not found.]
> EmpPhotos.stats.Page_Load(Object sender, EventArgs e) +0
> System.Web.UI.Control.OnLoad(EventArgs e) +67
> System.Web.UI.Control.LoadRecursive() +35
> System.Web.UI.Page.ProcessRequestMain() +750
> ----------------------------------------------------------------------
> ----------
> Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
> ASP.NET Version:1.1.4322.2032



 
Reply With Quote
 
 
 
 
Rick Strahl [MVP]
Guest
Posts: n/a
 
      08-19-2005

You need to tell ASP.NET explicitly to look for assemblies in the GAC.
Unlike WinForms application which automatically look in the GAC, ASP.NET
applications do not.

You can do this by adding something like this:

<compilation defaultLanguage="c#" debug="true">

<assemblies>

<add assembly="MyAssembly.MyClass, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>

</assemblies>

</compilation>


to web.config. You need to use the strong name for the assembly.


Hope this helps,

+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog

"Web Team @ Borough of Poole" <> wrote in message
news: oups.com...

> Hi All,
>
> I recently moved our assembly which stores our 'common' code into the
> GAC. I then moved all copies of this assembly out of the /bin folders,
> restarted IIS. I get the error below.
>
> This is the first time I have put something into the GAC, from what I
> read, the GAC is probed first, before looking to application folders,
> so surely my code should load from the GAC, if its not in the app
> folders? Or, is the error due to the way we have referenced the
> libraries when building (Referenced by project).
>
> Any help/advice on this will be appreciated.
>
> Thanks,
>
> Simon.
>
>
>
> Server Error in '/netapps' Application.
> --------------------------------------------------------------------------------
>
> File or assembly name OldInfra, or one of its dependencies, was not
> found.
> Description: An unhandled exception occurred during the execution of
> the current web request. Please review the stack trace for more
> information about the error and where it originated in the code.
>
> Exception Details: System.IO.FileNotFoundException: File or assembly
> name OldInfra, or one of its dependencies, was not found.
>
> Source Error:
>
> An unhandled exception was generated during the execution of the
> current web request. Information regarding the origin and location of
> the exception can be identified using the exception stack trace below.
>
>
> Assembly Load Trace: The following information can be helpful to
> determine why the assembly 'OldInfra' could not be loaded.
>
>
> === Pre-bind state information ===
> LOG: DisplayName = OldInfra, Version=1.0.2056.26999, Culture=neutral,
> PublicKeyToken=null
> (Fully-specified)
> LOG: Appbase = file:///D:/Introot/netapps
> LOG: Initial PrivatePath = bin
> Calling assembly : EmpPhotos, Version=1.0.2056.26999, Culture=neutral,
> PublicKeyToken=null.
> ===
>
> LOG: Policy not being applied to reference at this time (private,
> custom, partial, or location-based assembly bind).
> LOG: Post-policy reference: OldInfra, Version=1.0.2056.26999,
> Culture=neutral, PublicKeyToken=null
> LOG: Attempting download of new URL
> file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> Files/netapps/54285709/c2671f29/OldInfra.DLL.
> LOG: Attempting download of new URL
> file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> Files/netapps/54285709/c2671f29/OldInfra/OldInfra.DLL.
> LOG: Attempting download of new URL
> file:///D:/Introot/netapps/bin/OldInfra.DLL.
> LOG: Attempting download of new URL
> file:///D:/Introot/netapps/bin/OldInfra/OldInfra.DLL.
> LOG: Attempting download of new URL
> file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> Files/netapps/54285709/c2671f29/OldInfra.EXE.
> LOG: Attempting download of new URL
> file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> Files/netapps/54285709/c2671f29/OldInfra/OldInfra.EXE.
> LOG: Attempting download of new URL
> file:///D:/Introot/netapps/bin/OldInfra.EXE.
> LOG: Attempting download of new URL
> file:///D:/Introot/netapps/bin/OldInfra/OldInfra.EXE.
>
>
>
> Stack Trace:
>
>
> [FileNotFoundException: File or assembly name OldInfra, or one of its
> dependencies, was not found.]
> EmpPhotos.stats.Page_Load(Object sender, EventArgs e) +0
> System.Web.UI.Control.OnLoad(EventArgs e) +67
> System.Web.UI.Control.LoadRecursive() +35
> System.Web.UI.Page.ProcessRequestMain() +750
>
>
>
>
> --------------------------------------------------------------------------------
> Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
> ASP.NET Version:1.1.4322.2032
>



 
Reply With Quote
 
Web Team @ Borough of Poole
Guest
Posts: n/a
 
      08-19-2005
Hi Rick,

Thanks for your reply. Couple of questions if you don't mind...

- Do I do this in the web.config for each application?
- I take it I would then have to rebuild all my apps?
- Where do I get the value for the PublicKeyToken attribute?

Cheers!

Simon.


Rick Strahl [MVP] wrote:
> You need to tell ASP.NET explicitly to look for assemblies in the GAC.
> Unlike WinForms application which automatically look in the GAC, ASP.NET
> applications do not.
>
> You can do this by adding something like this:
>
> <compilation defaultLanguage="c#" debug="true">
>
> <assemblies>
>
> <add assembly="MyAssembly.MyClass, Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a"/>
>
> </assemblies>
>
> </compilation>
>
>
> to web.config. You need to use the strong name for the assembly.
>
>
> Hope this helps,
>
> +++ Rick ---
>
> --
>
> Rick Strahl
> West Wind Technologies
> www.west-wind.com
> www.west-wind.com/weblog


 
Reply With Quote
 
dananos dananos is offline
Junior Member
Join Date: Aug 2008
Posts: 5
 
      08-06-2008
Hi,

Just to verify, that fix worked for me as well, you need to put a line in the web.config referencing the assembly.

A tip I found, is that if you add a reference to your GAC dll in your project, but need the format of the string to add into your web. config, then you can open the csproj file in notepad, then skip down to the Reference section, where your DLL is.

Regards

Dan
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Assembly in GAC, Page Inherits Strongly Named Assembly? john@johnwpowell.com ASP .Net 0 12-03-2005 01:31 PM
GAC but still get File or assembly name... was not found =?Utf-8?B?Smlt?= ASP .Net 3 06-06-2005 02:34 AM
Referencing assembly from GAC using @assembly fails Brent ASP .Net 1 01-23-2004 08:23 PM
RE: Can I have a signed assembly in Bin without putting it into GAC or not? Jacob Yang [MSFT] ASP .Net 1 08-29-2003 11:59 AM
IIS not retrieving latest version of assembly from GAC Eidolon ASP .Net 0 06-26-2003 01:53 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57