Activation error occured while trying to get instance of type Database, key RRS feed

  • Question

  • Hi Team,

    Please help me in solving below issue at the earliest.

    I am using Visual Studio 2010 and trying to connect MYSql database. Defined the connection string in Web.Config file using Microsoft Enterprise Library 5.0.

    Same code was working fine when i had Windows 7. I have upgraded to windows 10 and i am getting the below error now.

    Activation error occured while trying to get instance of type Database, key ""

    Detailed log entry is provided for your reference.

    Log Entry :

    Member ID:

    Member Name:

    Error Created Time:04/03/2019 17:33:41

    Error Message:Activation error occured while trying to get instance of type Database, key "TestDb"

    Class Name:ServiceLocatorImplBase

    Error Location:   at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 53

       at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService](String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 103

       at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.InnerCreateDatabase(String name) in e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\DatabaseFactory.cs:line 82

       at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase(String name) in e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\DatabaseFactory.cs:line 68

       at DAL.ServiceOrder..ctor() in C:\Users\vedavathi.gangadhar\Desktop\RM_Workspace_latest_code\Dimple\RM_Workspace_Ver_1.4\RM_Workspace\DAL\ServiceOrder.cs:line 15

       at DAL.ServiceOrder.GetCurrentClassObj() in C:\Users\vedavathi.gangadhar\Desktop\RM_Workspace_latest_code\Dimple\RM_Workspace_Ver_1.4\RM_Workspace\DAL\ServiceOrder.cs:line 20

       at BL.ServiceOrder..ctor() in C:\Users\vedavathi.gangadhar\Desktop\RM_Workspace_latest_code\Dimple\RM_Workspace_Ver_1.4\RM_Workspace\BL\ServiceOrder.cs:line 15

       at BL.ServiceOrder.GetCurrentClassObj() in C:\Users\vedavathi.gangadhar\Desktop\RM_Workspace_latest_code\Dimple\RM_Workspace_Ver_1.4\RM_Workspace\BL\ServiceOrder.cs:line 19

       at RMWorkspace.Login.GetUserDetails() in C:\Users\vedavathi.gangadhar\Desktop\RM_Workspace_latest_code\Dimple\RM_Workspace_Ver_1.4\RM_Workspace\RMWorkspace\Login.aspx.cs:line 62

       at RMWorkspace.Login.Page_Load(Object sender, EventArgs e) in C:\Users\vedavathi.gangadhar\Desktop\RM_Workspace_latest_code\Dimple\RM_Workspace_Ver_1.4\RM_Workspace\RMWorkspace\Login.aspx.cs:line 32

    Type Of Exception:ActivationException

    Below is the connection string that I am using to connect to the MySql Database in Web.config.



        <add name="TestDb" connectionString="Data Source=;Database=abc_xyz;User ID=****;Password=****;port=3306; respect binary flags=false" providerName="MySql.Data.MySqlClient"/>


    Below piece of code is used to open db connection in Database Access Layer.

    Database db = DatabaseFactory.CreateDatabase("TestDb");

    Wednesday, April 10, 2019 10:51 AM

All replies

  • Hi Vedavathi Gangadhar,

    Thank you for posting here.

    For your question is related to web.config, you could get help from ASP.NET forum.

    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions. 

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 11, 2019 7:10 AM