I have created a React Project using dotnetcore 3.1
Version. This is hosted on an IIS Server on AWS Lightsail
. We use AWS Lightsail Loadbalancers
. The Web Service communicates to an Microsoft SQL Server Express (64-bit) Database
, version 14.0.3281.6
using Entity Framework Core.
The problem we are facing is:
We make a call to the webservice via a POST
request. This runs a query on the database. This query fetches data from many related tables using Include()
For large data we have noticed that the web service return a 504 Gateway Timeout
.
We have tried setting the CommandTimeout
to 900 seconds as below
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
IConfigurationRoot configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.Build();
var connectionString = configuration.GetConnectionString("DefaultConnection");
optionsBuilder.UseSqlServer(connectionString, sqlServerOptions => sqlServerOptions.CommandTimeout(900));
}
}
Our Connection string
"DefaultConnection": "Data Source=server_name_here,port_number_here;Initial Catalog=db_name_here;Integrated Security=False;Persist Security Info=False;User ID=user_name_here;Password=password_here
Other things we have tried:
Setting the requestTimeout="00:20:00"
in the web.config
Application Pool settings screenshot
Are we missing something?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…