Assembly not found when in GAC

Discussion in 'ASP .Net' started by Web Team @ Borough of Poole, Aug 19, 2005.

  1. 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
    Web Team @ Borough of Poole, Aug 19, 2005
    #1
    1. Advertising

  2. Web Team @ Borough of Poole

    Guest

    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
    , Aug 19, 2005
    #2
    1. Advertising

  3. 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:...

    > 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
    >
    Rick Strahl [MVP], Aug 19, 2005
    #3
  4. 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
    Web Team @ Borough of Poole, Aug 19, 2005
    #4
  5. Web Team @ Borough of Poole

    dananos

    Joined:
    Aug 6, 2008
    Messages:
    4
    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
    dananos, Aug 6, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eidolon
    Replies:
    0
    Views:
    1,993
    Eidolon
    Jun 26, 2003
  2. Jacob Yang [MSFT]
    Replies:
    1
    Views:
    385
  3. Brent
    Replies:
    1
    Views:
    1,357
    Brent
    Jan 23, 2004
  4. =?Utf-8?B?Smlt?=
    Replies:
    3
    Views:
    3,796
    Steven Cheng[MSFT]
    Jun 6, 2005
  5. Replies:
    0
    Views:
    672
Loading...

Share This Page