When I make a call on an API with this program.cs the response will take at least 2000ms but why ?
Here is my Program.cs and what I've changed:
public readonly static string[] URLS = new string[] { "http://0.0.0.0:5250", "https://0.0.0.0:5251" };
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers()
.AddNewtonsoftJson();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
#region this is what I added to the template:
builder.WebHost.UseKestrel();
builder.WebHost.UseUrls(URLS);
#endregion
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
}
CodePudding user response:
I changed the URLS from (avg. responsetime >2000ms):
public readonly static string[] URLS = new string[] { "http://0.0.0.0:5250", "https://0.0.0.0:5251" };
to this (avg. responsetime 30-50ms):
public readonly static string[] URLS = new string[] { "http://*:5250", "https://*:5251" };
CodePudding user response:
public readonly static string[] URLS = new string[] { "http://0.0.0.0:5250", "https://0.0.0.0:5251" };