Shared Assemblies and web.config config serctions

Discussion in 'ASP .Net' started by Sam-I-Am, Jul 21, 2004.

  1. Sam-I-Am

    Sam-I-Am Guest

    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
     
    Sam-I-Am, Jul 21, 2004
    #1
    1. Advertising

  2. Sam-I-Am

    Shan Plourde Guest

    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.

    Sam-I-Am wrote:

    > 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
     
    Shan Plourde, Jul 21, 2004
    #2
    1. Advertising

  3. Sam-I-Am

    Sam-I-Am Guest

    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>


    "Sam-I-Am" <> wrote in message
    news:...
    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
     
    Sam-I-Am, Jul 21, 2004
    #3
  4. 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
     
    Steven Cheng[MSFT], Jul 21, 2004
    #4
    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. RadekP
    Replies:
    0
    Views:
    902
    RadekP
    Jun 25, 2003
  2. Invalidlastname

    ASP.NET and shared assemblies

    Invalidlastname, Dec 1, 2003, in forum: ASP .Net
    Replies:
    8
    Views:
    865
    Jim Cheshire [MSFT]
    Dec 4, 2003
  3. Phi!
    Replies:
    1
    Views:
    327
    Philip Q [MVP]
    Apr 23, 2004
  4. Javier Martinez
    Replies:
    27
    Views:
    776
    Juan T. Llibre
    Nov 15, 2005
  5. thiyag2001

    Shared Assemblies

    thiyag2001, Jun 26, 2006, in forum: .NET
    Replies:
    0
    Views:
    329
    thiyag2001
    Jun 26, 2006
Loading...

Share This Page