In Visual Studio 2019, I start my .NET Core 3 Wep API. It runs and accepts requests.
Then, in my Angular UI, I have a new section to choose a file. If I click that, then choose a file, or hit cancel in the open dialog, my Web API app shuts down. I'm trying to understand how that's possible. I'm only doing front-end stuff. There are no network calls being made.
Here is the screenshot of what I click.
When I hit cancel, my Web API stops. I can see in VS that my run button is enabled again, like it's ready to be started once more.
On the front end, this is all that's happening:
<label style="float: left;">
<input #imageInput
type="file"
accept="image/*"
(change)="processFile(imageInput)">
</label>
<div [ngStyle]="{'background-image': 'selectedImage'}">
</div>
This is the processFile()
function:
processFile(imageInput: any) {
// https://www.freecodecamp.org/news/how-to-make-image-upload-easy-with-angular-1ed14cb2773b/
console.log('in process file');
//this.selectedImage = imageInput;
}
You can see that there is only a call to log something. In dev tools, there is no network call or console error. How does selecting a file (or hitting cancel in the open dialog) cause my back end service to stop? I'm not even sure what to check.
CodePudding user response:
I don't know why the issue occurs, but you can try this in Visual Studio:
Turn off Tools > Options > Projects and Solutions > Web Projects -> Stop debugger when browser window is closed, close browser when debugging stops
to see if this fixes the issue.