Problem loading strongly named assembly within ASP.NET app

P

Paul Ingles

Hi,

I have an ASP.NET Web Application which uses a number of controls in an
external strongly named assembly.

Whenever I view a page that uses one of the controls within the strongly
named assembly a FileLoadException is thrown, saying that "The located
assembly's manifest definition with name 'CentaurNet.Web.Controls' does not
match the assembly reference".

Here's the most relevant stuff from the stack trace:

=== Pre-bind state information ===
LOG: DisplayName = Company.Web.Controls, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/WEB/Sites/NewDesignPartners/1.0.0
LOG: Initial PrivatePath = bin
Calling assembly : e0chcp-a, Version=0.0.0.0, 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: Company.Web.Controls, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
LOG: Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/sites_testsite_1.0.0/c5ac8176/c4508797/Company.Web.Controls.DLL.
LOG: Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/sites_testsite_1.0.0/c5ac8176/c4508797/Company.Web.Controls/Company.Web.Controls.DLL.
LOG: Attempting download of new URL
file:///C:/WEB/Sites/TestSite/1.0.0/bin/Company.Web.Controls.DLL.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN

The public key remains the same between builds, and the assembly copied to
the web project directory during VS's build process is the same.

The really bizarre thing is that the control does appear to get loaded ok,
the control is also used on the error page and this loads fine -- I can even
break into the debugger and the control is initialised as it should,
properties are set correctly etc.

Any suggestions would be welcome,
Paul
 
K

Kevin Yu [MSFT]

Hi Paul,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
S

Steven Cheng[MSFT]

Hi Paul,

From your description, you have a strong-named assembly which contains some
custom webcontrols. Now, you used it in one of your asp.net web
applications and put in the private bin dir, but at runtime, you'll get
error said that the assembly's strong-named keytoken is mismatch with the
application assembly's metadata manifest, yes?

BAsed on my experience, the problem is likely due to the location of the
strong-named assembly. Different from normal .net application, the ASP.NET
application doesn't support strong-named assembly in private bin path,
that'll cause some unexpected errors(there is some known issue on
strong-named assembly in private bin path). So all the strong-named
assembly that used in ASP.NET app need to be put into GAC.
So currently my suggestion is :
1. use the ILDASM to open the custom control assenmbly and your web
application assembly(which referene that control assembly) to see whether
the public key token info in their assembly manifest are identical.

2. If #1 is ok, then move that strong-named assembly from private bin path
to GAC and restart your application(recycle iis) and test again.

Hope helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

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