Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Referencing a assembly from the GAC

Reply
Thread Tools

Referencing a assembly from the GAC

 
 
=?Utf-8?B?RGFsZQ==?=
Guest
Posts: n/a
 
      04-21-2006
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.
 
Reply With Quote
 
 
 
 
S. Justin Gengo
Guest
Posts: n/a
 
      04-21-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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.



 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      04-24-2006
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.)









 
Reply With Quote
 
=?Utf-8?B?RGFsZQ==?=
Guest
Posts: n/a
 
      04-24-2006
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.)
>
>
>
>
>
>
>
>
>
>

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      04-25-2006
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.)





 
Reply With Quote
 
=?Utf-8?B?RGFsZQ==?=
Guest
Posts: n/a
 
      04-25-2006
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.)
>
>
>
>
>
>

 
Reply With Quote
 
=?Utf-8?B?RGFsZQ==?=
Guest
Posts: n/a
 
      04-25-2006
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.)
>
>
>
>
>
>

 
Reply With Quote
 
=?Utf-8?B?RGFsZQ==?=
Guest
Posts: n/a
 
      04-25-2006
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,Vers ion=1.0.0.0,
Culture=neutral, PublicKeyToken=bcd6707151635d07" />

Thanks everyone for your help.
 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      04-26-2006
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.)

 
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
referencing assembly in GAC Rod Snyder ASP .Net 3 12-29-2004 03:03 PM
Referencing Assembly Question Without GAC? =?Utf-8?B?TWlrZQ==?= ASP .Net 12 12-02-2004 04:59 AM
Referencing assembly from GAC using @assembly fails Brent ASP .Net 1 01-23-2004 08:23 PM
how to reference a shared assembly from the GAC ? Joe Abou Jaoude ASP .Net 1 11-06-2003 10:08 PM



Advertisments