相关文章推荐
追风的啤酒  ·  为什么gateway 启动时 ...·  6 天前    · 
小胡子的荔枝  ·  batch file if file ...·  9 月前    · 
爱逃课的剪刀  ·  FTP命令 - iTech - 博客园·  1 年前    · 
调皮的斑马  ·  Power Query Impala ...·  1 年前    · 
I am getting 504 gatewaytimeout error on server after upload 3.92 MB files
but record get inserted into table successfully
i have 1 webserver and 1 appserver
on Webserver:
- i am reading excel file and convert it into datable and save excel
into another folder its hardly take 1 min 20 sec
- then i passed that datable to to appserver using following code
sProposal = Task.Run( async () => UploadDetails x = await webAPIClient.CallWebAPI<UploadDetails, DataTable>(dataTable, ConfigurationManager.AppSettings[ " Url" ].ToString()); return x; on Appserver
- i take datatable and pass into sqlbulkcopy and insert into table ,return with only success msg it hardly get few sec
Following is my web.config
<location path= " upl" > <system.web> <!--The default size is 4096 kilobytes ( 4 MB). MaxValue is 2147483647 KB ( 2 TB)--> <!-- 100 MB in kilobytes --> <httpRuntime executionTimout= " 3600" maxRequestLength= " 2147483647" /> </ system.web > <system.webServer> <security> <requestFiltering> <!--The default size is 30000000 bytes ( 28 . 6 MB). MaxValue is 4294967295 bytes ( 4 GB)--> <!-- 100 MB in bytes --> <requestLimits maxAllowedContentLength= " 4294967295" /> </ requestFiltering > </ security > </ system.webServer > </ location >
i also increase maxRequestLength,maxAllowedContentLength also but still it showing 504 gateway timeout on server
but record get inserted successfully (total 45,345 record)
What I have tried:
i also increase maxRequestLength,maxAllowedContentLength, and profile code which code take what time and all but still 504 error is coming The maximum request length has no bearing on a timeout error. If you try to upload a file that's too large, you'll get a 404 error, not a timeout error.
Quote:
I am reading excel file and convert it into datable and save excel into another folder its hardly take 1 min 20 sec
I take datatable and pass into sqlbulkcopy and insert into table ,return with only success msg it hardly get 1 min and few sec
So your total execution time is somewhere over 2 minutes 20 seconds - ie: more than 140 seconds.
The default execution timeout depends on your application:
.NET Framework:
WebForms and synchronous MVC actions: 110 seconds.
Asynchronous MVC actions: 45 seconds.
.NET Core:
120 seconds.
All of those numbers are way below the length of time you've told us your code takes to execute.
If you can't get your code to run faster, you need to increase the execution timeout limit.
.NET Framework
WebForms and synchronous MVC actions:
In web.config, set configuration/system.web/httpRuntime/@executionTimeout to the number of seconds required - eg: 300
Asynchronous MVC actions:
Add the AsyncTimeout attribute [ ^ ] to your action, and specify the number of milliseconds required - eg: [AsyncTimeout(300_000)]
.NET Core
In web.config, set configuration/system.webServer/aspNetCore/@requestTimeout to the required time - eg: 00:05:00 .
  • Read the question carefully.
  • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  • Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
  •