Hangfire with Mysql don´t work

mysql
Tags: #<Tag:0x00007f759607f360>

#1

I’m using hangfire with mysql in my WebApi C # application. I do not know if I can have a conflict with EntityFramework … Have you had this problem? I need help!
Thank you


MySqlException (0x80004005): Authentication to host mysql.test.com; for user root; using method;mysql_native_password; failed with message: Reading from the stream has failed

[MySqlException (0x80004005): Reading from the stream has failed.]
MySql.Data.MySqlClient.MySqlStream.LoadPacket() +270
MySql.Data.MySqlClient.MySqlStream.ReadPacket() +32
MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket() +39

    public void Configuration(IAppBuilder app)
    {
        HttpConfiguration config = new HttpConfiguration();

        ConfigureOAuth(app);

        App_Start.WebApiConfig.Register(config);
        app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
        app.UseWebApi(config);

        Hangfire.GlobalConfiguration.Configuration.UseStorage(new Hangfire.MySql.MySqlStorage(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString));
        app.UseHangfireDashboard("/PainelEmails", new DashboardOptions
        {
            AppPath = "http://website.com/index.html"//,
            //Authorization = new[] { new HangfireAuthorization() }
        });

        EnvioEmailController obj = new EnvioEmailController();
        RecurringJob.AddOrUpdate(() => obj.SendEmailRelato(), Cron.Hourly);
        RecurringJob.AddOrUpdate(() => obj.SendEmailRelatoTentativa(), Cron.Hourly);
        RecurringJob.AddOrUpdate(() => obj.SendEmail30Dias(), Cron.Hourly);
        RecurringJob.AddOrUpdate(() => obj.SendEmail60Dias(), Cron.Hourly);
        RecurringJob.AddOrUpdate(() => obj.SendEmail90Dias(), Cron.Hourly);

        app.UseHangfireServer(new BackgroundJobServerOptions()
        {
            WorkerCount = 2
        });
    }

#2

Hey man this error has nothing to do with Hangfire. Your connectionstring is problem. Try this it should work: https://stackoverflow.com/questions/26652833/reading-from-the-stream-has-failed-mysqlexception and try to learn investigate the problem