MySqlHelper.ExecuteReader 爬坑
MySqlDataReader reader = MySqlHelper.ExecuteReader
拿数据后并未执行reader.Close()
结果:
数据库连接池超限,后端跑一段时间后就会造成服务器崩掉
报错信息:
error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
查询各种之后得到结论: reader结果不关闭的话,当前数据库连接也不会关,由于前端在一直请求,就造成超过连接池的问题了
所以:如果用ExecuteReader,拿 到reader后的数据内容后一定要执行: reader.Close()