简体   繁体   English

Asp.net 核心 Web API 使用 Dapper 执行 Postgres function 引发“读取超时”和“读取流时异常”

[英]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.

相关问题 无法从逻辑应用执行 HTTP 后操作到 Asp.net 核心 Web API - Can't perform HTTP Post Action from Logic App to Asp.net Core Web API ASP.NET Core 5.0 Web API 部署在应用程序服务调用第三方 API 间歇性失败并引发 500(内部服务器错误) - ASP.NET Core 5.0 Web API deployed in App service call third party API fails intermittently and raise 500 (Internal Server Error) 如何在 session 超时后从 BigQuery Storage API 恢复读取 - How to resume reading from BigQuery Storage API upon session timeout ASP.NET 核心 6 Web API 与 firebase 身份验证和反应前端承载身份验证失败 - ASP.NET Core 6 Web API with firebase auth and react front end bearer auth fails asp.net 核心 web api (.net 6) 使用 startup.cs 而不是 program.cs 创建项目 - asp.net core web api (.net 6) created project with startup.cs instead of program.cs 从 lambda function 读取 AWS S3 内的 excel 文件时超时 - timeout when reading excel file inside AWS S3 from lambda function 来自 ASP.NET Core 3.1 web 应用程序的 OpenIdDict 3.0 错误 - OpenIdDict 3.0 error from ASP.NET Core 3.1 web application ASP.NET 5 Web API 应用程序间歇性无响应 - ASP.NET 5 Web API application intermittently unresponsive 在 ASP.NET Core MVC 中从 Cognito 注销时出错 - Error logging out from Cognito in ASP.NET Core MVC 从运动流中读取数据失败 - Reading data from kinesis stream unsuccessfully
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM