I have a Blazor Server app which creates a zip file in memory and delivers that zip file via an call to a get method of an controller. I use following call inside of a button to start the download:
navigationManager.NavigateTo($"api/DownloadFile?RequestGuid={WebUtility.UrlEncode(RequestGuid.ToString())}", true);
Everything works fine, but 1 or 2 minutes after the successfull download the application crashs with following error:
Microsoft.AspNetCore.Components.Server.Circuits.RemoteNavigationManager[4] Navigation failed when changing the location to api/DownloadFile?RequestGuid=db296363-ec46-4661-a8f5-78f9537114bc System.Threading.Tasks.TaskCanceledException: A task was canceled. at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at Microsoft.AspNetCore.Components.Server.Circuits.RemoteNavigationManager.<>c__DisplayClass13_0.<g__PerformNavigationAsync|0>d.MoveNext()
Is there any workaround on how to avoid this issue?