Referencing a assembly from the GAC

Discussion in 'ASP .Net' started by =?Utf-8?B?RGFsZQ==?=, Apr 21, 2006.

  1. I have created a class that implements IHttpModule and I want to use the
    module on several of the web sites that exist on my server. The module works
    great if I place the dll in a web applications bin directory. However, I
    can’t get it to work at all from the GAC. If I remove the dll from the web
    applications bin file, I get the following error: File or assembly name
    RequestHandler, or one of its dependencies, was not found.

    The assembly exists in the GAC. It seems like the web application isn’t
    looking in the GAC.

    Any help would be appreciated.
     
    =?Utf-8?B?RGFsZQ==?=, Apr 21, 2006
    #1
    1. Advertising

  2. Dale,

    The application should automatically look in the GAC first. But it looks for
    specific versions. Did you happen to rebuild it before placing it in the GAC
    and maybe with an automatically incremented version number? If that's the
    case you should manually set the version number and you may have to
    re-reference the new build in each of your sites so that they will be
    looking for the new version.

    To state my guess slightly differently I think the version of your .dll in
    the GAC is a newer version than the ones in your bin directories...

    Regards,

    --
    S. Justin Gengo
    Web Developer / Programmer

    Free code library:
    http://www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche


    "Dale" <> wrote in message
    news:...
    >I have created a class that implements IHttpModule and I want to use the
    > module on several of the web sites that exist on my server. The module
    > works
    > great if I place the dll in a web applications bin directory. However, I
    > can't get it to work at all from the GAC. If I remove the dll from the web
    > applications bin file, I get the following error: File or assembly name
    > RequestHandler, or one of its dependencies, was not found.
    >
    > The assembly exists in the GAC. It seems like the web application isn't
    > looking in the GAC.
    >
    > Any help would be appreciated.
     
    S. Justin Gengo, Apr 21, 2006
    #2
    1. Advertising

  3. Hi Dale,

    I agree with Justin that for strong-named assemblies, when we reference
    them in ASP.NET web.config file for some custom component(httphandler or
    httpmodule...), we must provide their full assembly name. The full name
    include assembly filename, version, culture and publickeytoken. Have you
    provided all these info for your strong-named assembly(whch contains the
    httpmodule class) in GAC?

    Regards,

    Steven Cheng
    Microsoft Online Community Support


    ==================================================

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Apr 24, 2006
    #3
  4. Here is the exact tag that I am using in the web.config file:

    <httpModules>
    <add name="rh" type="Dashboard.RequestHandler, RequestHandler,
    Version=1.0.0.0, Culture=neutral,
    PublicKeyToken=bcd6707151635d07" />
    </httpModules>

    I got these values by looking at the assembly from the .NET Configuration
    1.1 tool. I wish I could insert a screen shot :-(.

    Is there any other reason that would prevent the application from searching
    the GAC?

    Thanks for your help.

    "Steven Cheng[MSFT]" wrote:

    > Hi Dale,
    >
    > I agree with Justin that for strong-named assemblies, when we reference
    > them in ASP.NET web.config file for some custom component(httphandler or
    > httpmodule...), we must provide their full assembly name. The full name
    > include assembly filename, version, culture and publickeytoken. Have you
    > provided all these info for your strong-named assembly(whch contains the
    > httpmodule class) in GAC?
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Community Support
    >
    >
    > ==================================================
    >
    > When responding to posts, please "Reply to Group" via your newsreader so
    > that others may learn and benefit from your issue.
    >
    > ==================================================
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
     
    =?Utf-8?B?RGFsZQ==?=, Apr 24, 2006
    #4
  5. Thanks for your response Dale,

    So far I haven't found any particular things which may prevent the GAC from
    working. And for general troubleshooting, you can try using the Fusion Log
    Viewer to trace the assembly binding processing in your application to see
    which assembly is it looking for:

    #Assembly Binding Log Viewer (Fuslogvw.exe)
    http://msdn2.microsoft.com/en-us/library/e74a18c4.aspx

    Regards,

    Steven Cheng
    Microsoft Online Community Support


    ==================================================

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Apr 25, 2006
    #5
  6. Thanks Steven,

    I have opened up the Fusion Log, and there is nothing there. It looks like
    no logs have been created at all. Does this point me to a differnt problem?

    Dale

    "Steven Cheng[MSFT]" wrote:

    > Thanks for your response Dale,
    >
    > So far I haven't found any particular things which may prevent the GAC from
    > working. And for general troubleshooting, you can try using the Fusion Log
    > Viewer to trace the assembly binding processing in your application to see
    > which assembly is it looking for:
    >
    > #Assembly Binding Log Viewer (Fuslogvw.exe)
    > http://msdn2.microsoft.com/en-us/library/e74a18c4.aspx
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Community Support
    >
    >
    > ==================================================
    >
    > When responding to posts, please "Reply to Group" via your newsreader so
    > that others may learn and benefit from your issue.
    >
    > ==================================================
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    >
    >
    >
    >
    >
     
    =?Utf-8?B?RGFsZQ==?=, Apr 25, 2006
    #6
  7. Does this stack trace help at all?


    === Pre-bind state information ===
    LOG: DisplayName = RequestHandler, Culture=neutral
    (Partial)
    LOG: Appbase = file:///E:/Inetpub/wwwroot/BI_Reports/Mack/Main
    LOG: Initial PrivatePath = bin
    Calling assembly : (Unknown).
    ===

    LOG: Policy not being applied to reference at this time (private, custom,
    partial, or location-based assembly bind).
    LOG: Post-policy reference: RequestHandler, Culture=neutral
    LOG: Attempting download of new URL
    file:///c:/windows/microsoft.net/framework/v1.1.4322/Temporary ASP.NET
    Files/mackvolvo/2bca50e6/cffb0f2f/RequestHandler.DLL.
    LOG: Attempting download of new URL
    file:///c:/windows/microsoft.net/framework/v1.1.4322/Temporary ASP.NET
    Files/mackvolvo/2bca50e6/cffb0f2f/RequestHandler/RequestHandler.DLL.
    LOG: Attempting download of new URL
    file:///E:/Inetpub/wwwroot/BI_Reports/Mack/Main/bin/RequestHandler.DLL.
    LOG: Attempting download of new URL
    file:///E:/Inetpub/wwwroot/BI_Reports/Mack/Main/bin/RequestHandler/RequestHandler.DLL.
    LOG: Attempting download of new URL
    file:///c:/windows/microsoft.net/framework/v1.1.4322/Temporary ASP.NET
    Files/mackvolvo/2bca50e6/cffb0f2f/RequestHandler.EXE.
    LOG: Attempting download of new URL
    file:///c:/windows/microsoft.net/framework/v1.1.4322/Temporary ASP.NET
    Files/mackvolvo/2bca50e6/cffb0f2f/RequestHandler/RequestHandler.EXE.
    LOG: Attempting download of new URL
    file:///E:/Inetpub/wwwroot/BI_Reports/Mack/Main/bin/RequestHandler.EXE.
    LOG: Attempting download of new URL
    file:///E:/Inetpub/wwwroot/BI_Reports/Mack/Main/bin/RequestHandler/RequestHandler.EXE.

    "Steven Cheng[MSFT]" wrote:

    > Thanks for your response Dale,
    >
    > So far I haven't found any particular things which may prevent the GAC from
    > working. And for general troubleshooting, you can try using the Fusion Log
    > Viewer to trace the assembly binding processing in your application to see
    > which assembly is it looking for:
    >
    > #Assembly Binding Log Viewer (Fuslogvw.exe)
    > http://msdn2.microsoft.com/en-us/library/e74a18c4.aspx
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Community Support
    >
    >
    > ==================================================
    >
    > When responding to posts, please "Reply to Group" via your newsreader so
    > that others may learn and benefit from your issue.
    >
    > ==================================================
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    >
    >
    >
    >
    >
     
    =?Utf-8?B?RGFsZQ==?=, Apr 25, 2006
    #7
  8. I feel like a complete bone head right now. I removed the new line characters
    from the tag in the web.config file and it works fine now.

    In other words, I changed this:

    <add name="rh" type="Dashboard.RequestHandler, RequestHandler,
    Version=1.0.0.0, Culture=neutral,
    PublicKeyToken=bcd6707151635d07" />

    To this:

    <add name="rh"
    type="Dashboard.RequestHandler,RequestHandler,Version=1.0.0.0,
    Culture=neutral, PublicKeyToken=bcd6707151635d07" />

    Thanks everyone for your help.
     
    =?Utf-8?B?RGFsZQ==?=, Apr 25, 2006
    #8
  9. Thanks for your followup Dale,

    Glad that you've finally figured out the problem.

    BTW, from the former log you pasted
    ==================
    === Pre-bind state information ===
    LOG: DisplayName = RequestHandler, Culture=neutral
    (Partial)
    LOG: Appbase = file:///E:/Inetpub/wwwroot/BI_Reports/Mack/Main
    LOG: Initial PrivatePath = bin
    Calling assembly : (Unknown).
    ===
    ====================

    the below line indicate that the runtime is looking for a partial named
    assembly(not strong-named), so this is also a clues help us find there
    should be something incorrect with the assembly reference configuration.

    LOG: DisplayName = RequestHandler, Culture=neutral
    (Partial)

    So the fusion log viewer is quite useful for troubleshooting assembly
    locating/referencing issue.

    Have a good day!

    Regards,

    Steven Cheng
    Microsoft Online Community Support


    ==================================================

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Apr 26, 2006
    #9
    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. Joe Abou Jaoude

    how to reference a shared assembly from the GAC ?

    Joe Abou Jaoude, Nov 6, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    588
    Mattias Sjögren
    Nov 6, 2003
  2. Brent
    Replies:
    1
    Views:
    1,390
    Brent
    Jan 23, 2004
  3. =?Utf-8?B?TWlrZQ==?=

    Referencing Assembly Question Without GAC?

    =?Utf-8?B?TWlrZQ==?=, Dec 1, 2004, in forum: ASP .Net
    Replies:
    12
    Views:
    800
    =?Utf-8?B?TWlrZQ==?=
    Dec 2, 2004
  4. Rod  Snyder

    referencing assembly in GAC

    Rod Snyder, Dec 27, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    3,875
    Ken Cox [Microsoft MVP]
    Dec 29, 2004
  5. Replies:
    0
    Views:
    708
Loading...

Share This Page