I have an odd issue related to running a React front end with a .Net Core 3.1 Web API. I used the Visual Studio template to create the app, so the client app exists inside my .Net Core project and is launched when I launch the API.
I have an API endpoint that returns a text/csv file via a FileStreamResult, and then I am using the npm package file-saver (https://www.npmjs.com/package/file-saver) to allow the client to save the file on the front end. The file is being returned and saved successfully, but every time I run the saveAs function from my client app, the API shuts down when running in IIS on Visual Studio It just stops. Nothing in the logs, though I have set them to verbose. It shows the API being hit and the response being returned, but nothing else. I've also searched the Event Logs, but can't find any errors at the times of the shutdowns. It happens consistently. If I dont' save the file, the API does not shut down, but as soon as I save the file, it does.
If I run the API from Powershell using 'dotnet run,' the file is returned and saved successfully and the API does not shut down. I feel like this might be an IIS configuration issue, but I'm not sure how to resolve it.
I'm running Visual Studio Community 2019 version 16.10.2 and .Net Framework version 4.8.04084
The code in my Startup.cs that runs the React app isapp.UseSpa(spa => { spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseProxyToSpaDevelopmentServer("http://localhost:3000"); } });
Thanks in advance....