C
C#2y ago
joy

sql timeout using dapper

hi all, im trying to use dapper in asp net core project and register this DapperContext as Transient im trying to make a request to GetNote endpoint, inside this GetNote endpoint there will be lots of request made to multiple tables, and after some time, i will get an exception from my api like this :
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding
can anyone help advise what could be the possible issue (im wondering if the Transient is correct)? i increased the Connection Timeout to 1000 already..
4 Replies
TheRanger
TheRanger2y ago
1000 milli seconds?
joy
joy2y ago
it's in second.. i saw this microsoft article defined 30 in seconds..
TheRanger
TheRanger2y ago
maybe you can't connect to your database?
joy
joy2y ago
i suddenly can get the api result after i remove the parallel async (using Task.WhenAll and now i use normal for loop instead) implemented inside my GetNote api, previously i change to use parallel async because the api return a result in a long time but im not sure why the Task.WhenAll causes the sql timeout issue..