[英]Asp.net Core Web API use Dapper to Execute Postgres function raise "Timeout during reading" and "Exception while reading from stream"
ASP.Net Core Web API use Dapper to execute Postgres function and get exception sometime "Timeout during reading" and exception title is "Exception while reading from stream". ASP.Net Core Web API 使用 Dapper 执行 Postgres function 有时出现异常“读取超时”,异常标题为“从流读取时异常”。
Web API deployed in Azure App service and Postgres is in Azure. Web API 部署在 Azure 应用服务和 Postgres 在 Azure。
The Postgres connection string is given below.下面给出了 Postgres 连接字符串。
Server=xyz.postgres.database.azure.com;Port=5432;Database=db1;Userid=user123;Password=pwd123;Timeout=120;Pooling=true;MinPoolSize=1;MaxPoolSize=30;Enlist=true;
Please give solution and reason for the issue.请给出问题的解决方案和原因。
Although the information you supplied is lacking.尽管缺少您提供的信息。 If I had to guess, I would say you are encountering command timeout issues.
如果非要我猜的话,我会说您遇到了命令超时问题。 The default command timeout is 30 seconds.
默认命令超时为 30 秒。 I presume you are using NpgSql driver.
我假设您正在使用 NpgSql 驱动程序。 The documentation says that the default is 30 seconds .
文档说默认值为 30 秒。 Try to add the following to your connection string and see if the timeout still occurs.
尝试将以下内容添加到您的连接字符串中,看看是否仍然出现超时。
Command Timeout=120;
This will set a timeout of 2 minutes这将设置 2 分钟的超时
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.