0

I am getting the below exception message when I publish my Asp.NET application to an AWS Elastic Beanstalk intance. The database is on Amazon RDS. The application runs fine locally with a local MySql database. I've tried many of the suggested answers on Stack Overflow but none have proven to work yet. Has anybody had this issue when deploying a .NET application?

The Entity Framework provider type 'MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' registered in the application config file for the ADO.NET provider with invariant name 'MySql.Data.MySqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName)

at System.Data.Entity.Internal.AppConfig.<.ctor>b__2(ProviderElement e)

at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()

at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)

at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

at System.Lazy`1.CreateValue()

at System.Lazy`1.LazyInitValue()

at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.RegisterDbProviderServices()

at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetServiceFactory(Type type, String name)

at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)

at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetService(Type type, Object key)

at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()

at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)

at System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type type, Object key)

at System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver)

at System.Data.Entity.DbContext.InitializeLazyInternalContext(IInternalConnection internalConnection, DbCompiledModel model)

at MichHerbAcumaticaApi.Models.ApplicationDbContext.Create()

at Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown ---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown ---

at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)

at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

<packages>
  ......
  <package id="MySql.Data" version="6.9.9" targetFramework="net452" />
  <package id="MySql.Data.Entity" version="6.9.9" targetFramework="net452" />
  <package id="MySql.Web" version="6.9.9" targetFramework="net452" />
  .....
</packages>

I've tried the following solutions with no luck: https://stackoverflow.com/a/40574224/5481661

Entity Framework Provider type could not be loaded?

.NET MySQL Connector Conflicting DbProviderFactories

Community
  • 1
  • 1
big_water
  • 3,024
  • 2
  • 26
  • 44
  • Can you elaborate on what you have tried? Is the MySQL Connector/NET part of the deployment? – jzonthemtn Apr 28 '17 at 19:20
  • Does the connector need to be installed separately on the server or is it part of the Nuget packages for MySql? I'm using v6.9.9 for the MySql packages. I included the MySql part of my package.json above. – big_water Apr 28 '17 at 20:11
  • The connector is part of the MySql.Data NuGet package. – jzonthemtn Apr 29 '17 at 18:35

1 Answers1

0

Please check if you have followed all the steps from the below mySQL documentation. As per the documentation it states that "Unless MySQL Connector/Net was installed with the standalone MSI or MySQL Installer, which adds the reference, insert the following data provider information into the app.config or web.config file:" https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html

Hope this helps.

Baskar Rao
  • 470
  • 4
  • 11
  • I have checked all of my setting to this documentation and it appears I have everything correct. Still not working :( – big_water Apr 28 '17 at 20:49
  • Please check the below settings are applied. http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_NET.rds.html – Baskar Rao Apr 28 '17 at 21:01
  • I did have that setup (that's the instructions I used originally) but it wasn't working. I ended up spinning up a new AWS instance and redeploying and it worked. Not sure why? Maybe some configuration got screwed up on the last one – big_water Apr 28 '17 at 21:05