Shared Assemblies and web.config config serctions

S

Sam-I-Am

Hi all

I have a common shared assembly in intalled in the GAC: myco.myprod.common.dll

I have set a reference to this assembly in a asp.net web application. I have config sections in my web.config like the following:

<configSections>
<section name="Configuration" type="myco.myprod.common.Configuration, myco.myprod.common" />
</configSections>

<Configuration>
<add key="MyKey" value="MyKeyValue" />
</Configuration>

I now get the following error:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Exception creating section handler.

All works fine if I reference a local copy of the myco.myprod.common.dll. I imagine it must be something with the way I have defined the reference to the assembly in the <section>

Has anyone else had the same problem?

Thanks,

Sam
 
S

Shan Plourde

I declare my assemblies in the system.web element:
<compilation defaultLanguage="c#" debug="true">
<assemblies>
<add assembly="<assembly name>, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=9ed54aaf75e356eb"/>
<add assembly="<assembly 2 name>, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=6019da3d2d8ab425"/>
<add assembly="etc., Version=1.0.0.0, Culture=neutral,
PublicKeyToken=8f6299a5dbc2b9ce"/>
</assemblies>
</compilation>

I specify the public key token because i strong name my assemblies.
Everything works great and I can reference types from within .ascx,
..aspx, or classs files without any issues.
 
S

Sam-I-Am

I have managed to find a solution. I needed to declare the assemblies using
the full assembly name including version, culuture and key like:

<configSections>
<section name="Configuration" type="myco.myprod.common.Configuration,
myco.myprod.common,, Version=1.0.0.1, Culture=neutral,
PublicKeyToken=10633fbfa3fade6e " />
</configSections>


Hi all

I have a common shared assembly in intalled in the GAC:
myco.myprod.common.dll

I have set a reference to this assembly in a asp.net web application. I have
config sections in my web.config like the following:

<configSections>
<section name="Configuration" type="myco.myprod.common.Configuration,
myco.myprod.common" />
</configSections>

<Configuration>
<add key="MyKey" value="MyKeyValue" />
</Configuration>

I now get the following error:
Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: Exception creating section handler.

All works fine if I reference a local copy of the myco.myprod.common.dll. I
imagine it must be something with the way I have defined the reference to
the assembly in the <section>

Has anyone else had the same problem?

Thanks,

Sam
 
S

Steven Cheng[MSFT]

Hi Sam,

Yes, when you put an assemlby into GAC, it means that the Assembly must be
Strong-Named. And in .net we must use Full-qualified name to reference a
strong-named assembly , just the signature as

<assembly name>, <version number>, <culture>, <strong name>

You may find the detailed description in the following reference:
#Referencing a Strong-Named Assembly
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconreferencingstrongl
y-namedassembly.asp?frame=true

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

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top