Referencing a assembly from the GAC


G

Guest

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.
 
Ad

Advertisements

S

S. Justin Gengo

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
 
S

Steven Cheng[MSFT]

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.)
 
G

Guest

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.
 
S

Steven Cheng[MSFT]

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.)
 
G

Guest

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
 
Ad

Advertisements

G

Guest

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.
 
G

Guest

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.
 
Ad

Advertisements

S

Steven Cheng[MSFT]

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.)
 

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

Top