Microsoft.Practices.ServiceLocation error using MySQLDriverCS

Topics: Data Access Application Block
Jun 3, 2010 at 9:43 PM

I have been trying to use the MySQLDriverCS data provider with EntLib 5.0

The App.config of the application is the following:

<configuration>
  <connectionStrings>
    <add name="xSolvingConn" connectionString="Data Source=X029\SQLEXPRESS;Initial Catalog=sid;User Id=root;Password=xxxx;Integrated Security=True;"
      providerName="System.Data.SqlClient" />
    <add name="mysqlConn"
      connectionString="Location=localhost;Data Source=sid;User ID=root;Password=xxxx;Port=3306;"
      providerName="MySQLDriverCS" />
  </connectionStrings>

  <appSettings>
  </appSettings>
</configuration>

The program has no exception when I use Visual Studio 2008 on the developer machine.
In the final machine on db = DatabaseFactory.CreateDatabase("mysqlConn") the exception is the following:

  Problem Event Name:      CLR20r3
  Problem Signature 01:    replotto.exe
  Problem Signature 02:    1.0.0.0
  Problem Signature 03:    4c07d517
  Problem Signature 04:    Microsoft.Practices.ServiceLocation
  Problem Signature 05:    1.0.0.0
  Problem Signature 06:    48cafcad
  Problem Signature 07:    15
  Problem Signature 08:    1c
  Problem Signature 09:    TUDBAWWAU4OGM1C33H2FCUFJSUT1ZN24
  OS Version:   6.1.7600.2.0.0.274.10
  Locale ID:    1040

The exception message is "Activation error occurred while trying to get instance of type Database, key "mysqlConn""
The exception source is "Microsoft.Practices.ServiceLocation"

Project references:

Microsoft.Practices.EnterpriseLibrary.Common
Microsoft.Practices.EnterpriseLibrary.Data
Microsoft.Practices.EnterpriseLibrary.PolicyInjection
Microsoft.Practices.EnterpriseLibrary.Security
Microsoft.VisualBasic
MySQLDriverCS
System
System.configuration
System.Core
System.Data
System.Deployment
System.Drawing
System.Web.Extensions
System.Windows.Forms
System.Xml


I have installed the program with setup in some machines with the following SO: Windows Xp, Windows Server 2000 and Windows Server 2008
and the error is the same
Some ideas?
Thanks

Jun 4, 2010 at 2:10 AM

In the machines where you're getting this error, is the Data assembly referenced from GAC?  If yes, refer to this issue for the details and the workaround.

 

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@Avanade.com

Jun 5, 2010 at 9:17 AM

No, in the machine where I get this error EntLib is not installed in the GAC.
Have you another idea?
Thanks

Jun 7, 2010 at 3:04 AM

How are you referencing the entlib assemblies? Do you assume that it is installed in the machine or you deploy it as part of your application?  Please post also the full message and stack trace.

 

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@Avanade.com