title: Error: Circuit has been shut down due to error. on downloading file from Blazor Server
body: <p>I created a webapp using Blazor Server. Part of the webapp is a file download as follows:</p>
  <pre><code>// called on button click, initiates the download
  private async Task OnDownloadRequest(FileEntry file)
  {
      NavManager.NavigateTo($&quot;/download/{file.Id}&quot;, true);
  }
  
  // MVC controller
  public class DownloadController
  {
      [HttpGet(&quot;~/download/{downloadId}&quot;)]
      public async Task&lt;IActionResult&gt; Download([FromServices] MyContext dbContext, long downloadId, CancellationToken cancel)
      {
          File file = await dbContext.Files.FindAsync(downloadId);
          Stream stream = new MemoryStream(file.Content); 
  
          var result = new FileStreamResult(stream, &quot;application/octet-stream&quot;)
          {
              FileDownloadName = file.Name,
              LastModified = file.LastModified
          };
  
          return result;
      }
  }
  
  // Startup.cs Configure method contains:
  app.UseEndpoints(endpoints =&gt;
  {
      endpoints.MapBlazorHub();
      endpoints.MapControllerRoute(&quot;mvc&quot;, &quot;{controller}/{action}&quot;);
      endpoints.MapFallbackToPage(&quot;/_Host&quot;);
  });
  </code></pre>
  <p>Actually the download of the file works fine, but at the same time Blazor crashes with:</p>
  <pre><code>blazor.server.js:19 [2020-09-05T11:33:02.200Z] Error: Circuit has been shut down due to error.
  e.log @ blazor.server.js:19
  blazor.server.js:1 [2020-09-05T11:33:02.202Z] Information: Connection disconnected.
  </code></pre>
  <p>Anyone knows why blazor crashes in this case and how to fix it?</p>