Unable to create a custom section for web.config

前端 未结 2 1386
半阙折子戏
半阙折子戏 2021-01-17 01:21

I created a custom section in the web.config file but it isn\'t able to load my custom type that is going to manage the section.

Here are the definitions:

         


        
相关标签:
2条回答
  • 2021-01-17 01:42

    You need to specify the assembly name as part of the type attribute:

    <section
        name="MembershipProviders"
        type="Namespace.TheCustomSection, TheAssemblyNameGoesHere"
        allowLocation="true"
        allowDefinition="Everywhere"
    />
    

    EDIT
    I didn't notice that the MembershipProvidersSection class is a nested class.
    The type name should be:

    MyApp.BusinessObjects.MembershipProviderFactory+MembershipProvidersSection
    
    0 讨论(0)
  • 2021-01-17 01:49

    You are missing assembly name where you are declaring type:

    MyApp.BusinessObjects.MembershipProviderFactory.MembershipProvidersSection,?
    

    Take a look at one of my posts about custom configuration: C# WCF System.Configuration.ConfigurationErrorsException: Unrecognized element 'ManagedService'

    0 讨论(0)
提交回复
热议问题