I need to run a 1-time long-running operation (around 10 minutes) via a ServiceStack service. I run this all on my local machine with ServiceStack running on IIS and .NET 5. Now it gives a timeout and I have no clue what is the cause (I also checked my IIS settings by the way). Part of my code (I removed some not relevant code):
static async Task Main(string[] args)
{
var jsonServiceClient = new JsonServiceClient("http://localhost/services");
jsonServiceClient.Timeout = TimeSpan.FromMinutes(20);
await CorrectCreationDates(jsonServiceClient);
}
private static async Task CorrectCreationDates(JsonServiceClient jsonServiceClient)
{
var request = new CorrectCreationDatesRequest();
var result = await jsonServiceClient.PostAsync(request);
}
This is the exception:
System.Net.WebException: 'The operation has timed out.'
This exception was originally thrown at this call stack:
ServiceStack.AsyncServiceClient.SendWebRequestAsync(string, string, object, System.Threading.CancellationToken, bool) in AsyncServiceClient.cs
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Gloneco.Importer.Program.CorrectCreationDates(ServiceStack.JsonServiceClient) in Program.cs
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
...
[Call Stack Truncated]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…