skip to Main Content

I’ve deployed my asp.net core 5 web api on IIS on the production server, and i’m getting this error:

Microsoft.EntityFrameworkCore.Database.Connection[20004] An error occurred using the connection to database ‘myDbName’ on server ‘my Ip (es. 171.1.1.0)’.
fail: Microsoft.EntityFrameworkCore.Query[10100] An exception occurred while iterating over the results of a query for context type ‘Orders_Sys_WebAPI.Models.serviziContext’.
System.InvalidOperationException: An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding ‘EnableRetryOnFailure()’ to the ‘UseMySql’ call.
MySqlConnector.MySqlException (0x80004005): Connect Timeout expired.
MySqlConnector.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.

I’m getting this error ONLY on the production server. I tried deploying on IIS on my laptop and everything works perfectly.

Is there any configuration on the server i’m missing? any ideas?

2

Answers


  1. Chosen as BEST ANSWER

    Found out with infrastructure team it was a network connection porblem. The server had some limitations.


  2. I tried deploying on IIS on my laptop and everything works perfectly

    But your error is…

    Unable to connect to any of the specified MySQL hosts.

    Did you check that mysqld was running without interruptions? Is it on the same host as IIS? If not, was your laptop connected to the same network as the host where the errors were reported? Using the same switch? DNS configuration? Did you check the mysqld logs?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search