Assembly not found when in GAC

  • Thread starter Web Team @ Borough of Poole
  • Start date
W

Web Team @ Borough of Poole

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
 
D

dennis.mulder

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
 
R

Rick Strahl [MVP]

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

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
 
W

Web Team @ Borough of Poole

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.
 
Joined
Aug 6, 2008
Messages
4
Reaction score
0
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top