CodeSmith Community
Your Code. Your Way. Faster!

System.Configuration.Provider.ProviderException: Unable to load NetTiersServiceSection

Latest post 05-28-2008 6:14 PM by arif_azim. 7 replies.
  • 07-11-2007 6:39 AM

    • jimboxx7
    • Top 10 Contributor
    • Joined on 06-15-2007
    • Quebec, Canada
    • Posts 523
    • Points 3,190

    System.Configuration.Provider.ProviderException: Unable to load NetTiersServiceSection

    The project is a dll that execute some functions of the DAL. 

    I have a test project on the same solution that tests my dll and everything is working fine.

    But when I use my dll in vb (tlb) it pops this error.
     
     System.Configuration.Provider.ProviderException: Unable to load NetTiersServiceSection
       at XXXDALTIERFX.DataAccessLayer.DataRepository.get_NetTiersSection() in C:\Documents and Settings\XXX\My Documents\Development\XXX\XXXDALTIERFX\XXXDALTIERFX.DataAccessLayer\DataRepository.cs:line 176
       at XXXDALTIERFX.DataAccessLayer.DataRepository.LoadProviders() in C:\Documents and Settings\XXX\My Documents\Development\XXX\XXXDALTIERFX\XXXDALTIERFX.DataAccessLayer\DataRepository.cs:line 100
       at XXXDALTIERFX.DataAccessLayer.DataRepository.get_Provider() in C:\Documents and Settings\XXX\My Documents\Development\XXX\XXXDALTIERFX\XXXDALTIERFX.DataAccessLayer\DataRepository.cs:line 118
       at XXXUtilities.clsEmailManager.getReportPath(String query) in C:\Documents and Settings\XXX\Desktop\Development\XXX\XXXUtilities\XXXUtilities\clsEmailManager.cs:line 193
       at TOFUUtilities.clsEmailManager.SendShippingEmail() in C:\Documents and Settings\XXX\Desktop\Development\XXX\XXXUtilities\XXXUtilities\clsEmailManager.cs:line 112

    the crashing line in my code is : SqlDataReader reader = (SqlDataReader)DataRepository.Provider.ExecuteReader(new CommandType(), query);

    It was working well before the changes, tough It was a different DAL and and different dll ( made changes to both).

    As I said, the dll works fine under C# project? what do you think? Plz I need support on this? Do you think the vb6 app gets a wrong version of the dll?

    If you need more info tell me plz
     

     

    • Post Points: 5
  • 07-11-2007 9:55 AM In reply to

    • jimboxx7
    • Top 10 Contributor
    • Joined on 06-15-2007
    • Quebec, Canada
    • Posts 523
    • Points 3,190

    Re: System.Configuration.Provider.ProviderException: Unable to load NetTiersServiceSection

    could you AT LEAST... tell me why there is no NetTiersServiceSection in Configurations.Section !!!

     What do i have to do to get answers from you guys? pay the premium service?

    I made another post yesterday and nobody replied. It is also the case for many other posters...
     

            public static NetTiersServiceSection NetTiersSection
            {
                get
                {
                    // Try to get a reference to the default <netTiersService> section
                    _section = WebConfigurationManager.GetSection("netTiersService") as NetTiersServiceSection;

                    if ( _section == null )
                    {
                        // otherwise look for section based on the assembly name
                        _section = WebConfigurationManager.GetSection("TOFUDALTIERFX.DataAccessLayer") as NetTiersServiceSection;
                    }

                    #region Design-Time Support

                    if ( _section == null )
                    {
                        // lastly, try to find the specific NetTiersServiceSection for this assembly
                        foreach ( ConfigurationSection temp in Configuration.Sections )
                        {
                            if ( temp is NetTiersServiceSection )
                            {
                                _section = temp as NetTiersServiceSection;
                                break;
                            }
                        }
                    }

                    #endregion Design-Time Support
                   
                    if ( _section == null )
                    {
                        throw new ProviderException("Unable to load NetTiersServiceSection");
                    }

                    return _section;
                }
            }

     

     

    • Post Points: 5
  • 07-11-2007 11:08 AM In reply to

    • jimboxx7
    • Top 10 Contributor
    • Joined on 06-15-2007
    • Quebec, Canada
    • Posts 523
    • Points 3,190

    Re: System.Configuration.Provider.ProviderException: Unable to load NetTiersServiceSection

    Reply |Contact |Answer

    Wow I finally resolved my problems, it was indeed an assembly version issue.

    But hey, THANK YOU AGAIN SO MUCH FOR ALL YOUR SUPPORT! WOOOOWWW

    I think I'm going to give points to myself on this one.

    I know the error wasn't about NetTiers, but damn... at least I learned more on how Nettiers works, because the day I have a real bug in it I think I'll have to solve it by myself.  

    • Post Points: 35
  • 07-11-2007 11:35 AM In reply to

    • bgjohnso
    • Top 10 Contributor
    • Joined on 09-15-2005
    • Spokane, WA
    • Posts 765
    • Points 22,535

    Re: System.Configuration.Provider.ProviderException: Unable to load NetTiersServiceSection

    Jimboxx7,

    I'm glad you resolved your issue, but I must say I'm not impressed with your attitude.  You have to realize that there are only a few active team members right now, and we all have real jobs, responsibilities, deadlines, etc.  This is an open source project and is not officially supported by CodeSmith.  I have looked at several of your posts, and they all have an air of entitlement to them.  We have lost a couple of great team members due to posters who demand solutions, are unwilling to help diagnose the issues and who are ungrateful once a solution is found.  I enjoy trying to help others out, but it gets very frustrating when dealing with people with attitudes like yours.

    On a side note, you said you found the problem but didn't elaborate on what you did to solve it.  Rather than ranting about the lack of support, perhaps you could detail your solution so if someone in the future has the same issue they can use your post to help resolve it.

    [Stepping down from soap box]

    Ben Johnson
    ------------------------------
     Member of the .NetTiers team
     Visit http://www.nettiers.com
    ------------------------------

    • Post Points: 35
  • 07-11-2007 1:16 PM In reply to

    • jimboxx7
    • Top 10 Contributor
    • Joined on 06-15-2007
    • Quebec, Canada
    • Posts 523
    • Points 3,190

    Re: System.Configuration.Provider.ProviderException: Unable to load NetTiersServiceSection

    I'm sorry with my attitude, but it is very frustrating to not event get an answer to your post when you have a problem that, most of the time, isn't directly related to the work you did.
    I've seen better and faster support on aquariums troubleshooting forums. Anyway, I'll promise to calm down from now on as I'm pretty sure I'll have to create new posts soon.
    I had to learn NetTiers not because I wanted to , but because It was already implanted in the systems I have to work on. If it was my code, I would be able to troubleshoot it easily.

    Maybe the programmer before me didn't realise that this project wasn't ready for a corporate environment.
    It's like If I had a problem with a Crystal Report getting corrupted and I wouldn't get any support for it.
    The difference with your project is that this is not a report, but the whole DAL. You know how it is critical. It just has to work.

    The NetTiers project is a wonderful project, with tremendous potential and the more I learn it, the more I learn about designing a perfect OO DAL.
    But the project is quite big and I don't have anything but the code to rely on when I have a problem. Now I understand the design of the DAL much better, but at first I have to admit that I was quite lost. And my problems are always stuff that I can't really troubleshoot, like generating the DAL and compiling it.

    I got 3 projects relying on the DAL. That means that if the DAL is not working I have to resolve it asap because I'm stuck on three different projects.
    If it was my own DAL I wouldn't bother you guys, because I would know how everything about it. 

    Again, I have to understand that you guys do this for free and I promise to calm down on my next posts.

    But I see so many unanswered posts with critical problems, at least please take the time to say that you will help him later.
    To me, when you don't post any answer, it's because you don't care about me and my problem.

     ----------------------------------------------------------

    The error I got was because the COM had references to an older dll of the DAL in the registry.
    How did I know ?

    Assembly Binding Log Viewer (Fuslogvw.exe)
    Displays details for failed assembly binds. This information helps you diagnose why the .NET Framework cannot locate an assembly at runtime.

    When regasm.exe binds the assemblies for the COM to work properly, it binds the dll in the parameter, but also every other dll (assemblies) used by this dll.
    The question is which dlls does this program gets? the ones in the folder of the COM dll project.

    So, if you make a new version of the DAL and don't delete (that what I did, maybe another workaround) the DAL dlls so it gets refreshed with the new dlls on build, you get the older ones as references. Even if you put the COM dll and the DAL dlls in the vb6 program folder, it will still get the reference from the project where the COM DLL was builded.

    and thats why I had this message System.Configuration.Provider.ProviderException: Unable to load NetTiersServiceSection.

    but I still don't know why I wasn't able to get an instance of the provider in the DAL.

    And I still don't understand why It was behaving this way with regasm and was working fine with my other test program in C#.
    Maybe because it is in the same solution.

    I have to say that it took me some time, but I learned about COM Interop with C#, regasm, fuslogvw, and even NetTiers design.
     

    • Post Points: 5
  • 07-11-2007 1:23 PM In reply to

    • jimboxx7
    • Top 10 Contributor
    • Joined on 06-15-2007
    • Quebec, Canada
    • Posts 523
    • Points 3,190

    Re: System.Configuration.Provider.ProviderException: Unable to load NetTiersServiceSection

    Reply |Contact |Answer

     Ok I just reread myself it's horrible,

     I'm going to redo the important part.

    Yhe error I got was because the COM had references to an older dll of the DAL in the registry.
    How did I know ?

    Assembly Binding Log Viewer (Fuslogvw.exe)
    Displays details for failed assembly binds. This information helps you diagnose why the .NET Framework cannot locate an assembly at runtime.

    When regasm.exe binds the assemblies for the COM to work properly, it binds the dll in the parameter, but also every other dll (assemblies) used by this dll.
    The question is which dlls does this program gets? the ones in the folder of the COM dll project.

    So, if you make a new version of the DAL and don't delete (that what I did, maybe another workaround) the DAL dlls in the COM dll folder, it won't refresh with the new version.

    You have to delete them so it gets refreshed with the new dlls.

    Even if you put the COM dll and the DAL dlls in the vb6 program folder, it will still get the reference from the project where the COM DLL was builded.

    and thats why I had this message System.Configuration.Provider.ProviderException: Unable to load NetTiersServiceSection.

    I still don't know why I wasn't able to get an instance of the provider in the DAL.

    And I don't understand why It was behaving this way with regasm and was working fine with my other test program in C#.


    Maybe because it is in the same solution.

    I have to say that it took me some time, but I learned about COM Interop with C#, regasm, fuslogvw, and even NetTiers design.
     


     

    • Post Points: 35
  • 07-11-2007 1:36 PM In reply to

    • bgjohnso
    • Top 10 Contributor
    • Joined on 09-15-2005
    • Spokane, WA
    • Posts 765
    • Points 22,535

    Re: System.Configuration.Provider.ProviderException: Unable to load NetTiersServiceSection

    Unfortunately, I don't have much experience with COM interop, so I don't know how much I can help.  The particular error you were seeing typically results from one of two issue.  The first issue is when it can't find the appropriate section in your app/web.config file.  The section either needs to be named netTiersService or <YourNamespace>.Data.  The second issue is when it can't find/load the config file at all.  In a COM interop situation, I'm not sure how it knows what config file to load or even how that particular config file should be named. 

    Ben Johnson
    ------------------------------
     Member of the .NetTiers team
     Visit http://www.nettiers.com
    ------------------------------

    • Post Points: 35
  • 05-28-2008 6:14 PM In reply to

    • arif_azim
    • Not Ranked
    • Joined on 05-28-2008
    • Posts 2
    • Points 10

    Re: System.Configuration.Provider.ProviderException: Unable to load NetTiersServiceSection

    According to http://community.codesmithtools.com/forums/p/3108/12847.aspx#12847 post, you need to change name of netTiersService2 in DataRepository.cs file.

    Go to DataRepository.cs and fix Configuration region -

    #region Configuration

    /// <summary>

    /// Gets a reference to the configured NetTiersServiceSection object.

    /// </summary>

    public static NetTiersServiceSection NetTiersSection

    {

    get

    {

    // Try to get a reference to the default <netTiersService2> section for 2nd database Yes

    _section = WebConfigurationManager.GetSection("netTiersService2") as NetTiersServiceSection;if ( _section == null )

    {

    // otherwise look for section based on the assembly name

    _section = WebConfigurationManager.GetSection("appstream.DataAccessLayer") as NetTiersServiceSection;

    }

    if ( _section == null )

    {

    throw new ProviderException("Unable to load NetTiersServiceSection");

    }

    return _section;

    }

    }

    #endregion Configuration

     

     

    Regards, Arif
    • Post Points: 5
Page 1 of 1 (8 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems