解决 Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 的问题

 在web 网站开发中,经常需要连接数据库,有时候会出现这样的数据连接异常消息:

主要原因是 应用程序与数据库的连接超出了数据库连接的默认时长,在这种情况下,我们可以把数据库连接的时长延长一些,因为 Connection 对象的 ConnectionTimeOut 是个只读属性不能对其进性赋值,但可以在连接字符串中进行设置

      <add name="ConnectionString" connectionString="Server=***;Port=3306;Database=***; Uid=***;Pwd=****; Connection Timeout=2880000" providerName="MySql.Data.MySqlClient"/>

原文地址:https://www.cnblogs.com/wisdo/p/4536205.html