question

HeatherWitt-7500 avatar image
0 Votes"
HeatherWitt-7500 asked PengGe-MSFT commented

.Net Core 3.1 API with React front end suddenly shutting down in Visual Studio IIS Express - using file-saver

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 is
app.UseSpa(spa => { spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseProxyToSpaDevelopmentServer("http://localhost:3000"); } });

Thanks in advance....

vs-debuggingdotnet-aspnet-core-webapi
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, @HeatherWitt-7500
I have not heard from you for a couple of days. Please let me know if there is anything that I can help here.

0 Votes 0 ·
PengGe-MSFT avatar image
0 Votes"
PengGe-MSFT answered

Hi @HeatherWitt-7500

Welcome to Microsoft Q&A!

Are you running the program in Debug mode?

You can try to run the program in Release or Kestrel mode to detect whether the issue exists. If the issue only occurs in Debug mode, can you try to collect logs in Visual Studio? If not, can you share more information to help us reproduce the issue?

I noticed that you have used this JS package, please make sure that the size of the file you want to save does not exceed the limit of this package, and whether the RAM is sufficient when saving.


Sincerely,
Peng


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

HeatherWitt-7500 avatar image
0 Votes"
HeatherWitt-7500 answered PengGe-MSFT commented

Thank you @PengGe-MSFT !

It happens in both Debug and Release mode from Visual Studio, but not when running from Powershell using dotnet run.

The files I'm working with are small .csv files - the largest so far was 118KB, so I don't think file size or RAM is an issue.

The output window shows the following:

The thread 0x2dbc has exited with code 0 (0x0).
The program '[10308] iisexpress.exe' has exited with code -1 (0xffffffff).

Once I turned on logging for VS, the following appeared in the Event Viewer:

Fault bucket , type 0
Event Name: VisualStudioNonFatalErrors2
Response: Not available
Cab Id: 0
Problem signature:
P1: iisexpresstray.exe
P2: 7.1.4403.1855
P3: vs.telemetry.internalfault
P4: System.IO.FileLoadException
P5: Microsoft.VisualStudio.Telemetry
P6: Microsoft.VisualStudio.ApplicationInsights.Channel.UniversalTelemetryChannel.IsAvailable
P7: _
P8: _
P9: _
P10: _
Attached files:
\\?\C:\Users\...\AppData\Local\Temp\VSFaultInfo\210727_033356_9009600\ErrorInformation.txt
These files may be available here:
Analysis symbol:
Rechecking for solution: 0
Report Id: 0de80fc2-af82-4385-b6e1-864e41d2f7d3
Report Status: 268697600
Hashed bucket:
Cab Guid: 0


And the file it references looks like:
```
Error Information
AppInsightsEvent Name = vs/telemetry/internalfault
Description = Exception in SessionChannel.EventProcessorChannel ProcessEvents Channel = eventProcessorChannel
TelemetrySession = '72b0c255-e669-4f2f-853d-faf98179cae7' Started = True OptIn=True IsInitialized = True Cloned = False
WatsonEventType = VisualStudioNonFatalErrors2
UTC time = 2021-07-27T20:33:56
Exception:
System.IO.FileLoadException
Could not load file or assembly 'Microsoft.Diagnostics.Tracing.EventSource, Version=1.1.28.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Microsoft.VisualStudio.ApplicationInsights.Channel.UniversalTelemetryChannel.IsAvailable()
Microsoft.VisualStudio.Telemetry.SessionChannel.AsimovAppInsightsClientWrapper.CreateAppInsightsChannel(TelemetryConfiguration config)
Microsoft.VisualStudio.Telemetry.SessionChannel.BaseAppInsightsClientWrapper.Initialize(String sessionId, String userId)
Microsoft.VisualStudio.Telemetry.EventProcessorRouter.RouteEvent(TelemetryEvent telemetryEvent, String sessionId, Boolean isDropped)
Microsoft.VisualStudio.Telemetry.SessionChannel.EventProcessorChannel.ProcessEvents()
WerReportAddDump PID=33664 iisexpresstray WerDumpTypeMiniDump
```

Thanks again for your reply.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, @HeatherWitt-7500
I tried many times but couldn't reproduce your issue. Can you provide some information for me to reproduce the issue?

0 Votes 0 ·

Hi @PengGe-MSFT , yes, I will put together a small app to reproduce the issue. It may be next week before I can post it though - I have a deadline this week. Thank you for your help!

0 Votes 0 ·

Hi, @HeatherWitt-7500
Okay, please let me know if you have any progress, I'm glad to help.

0 Votes 0 ·