Vs 2019 16.8.X - WebAPI is actively refusing the connection from Blazor app some of the time RRS feed

  • Question

  • User379720387 posted

    I am developing a Blazor Server Side app with a Web API.

    Typically I start the WebAPI first with CTRL F5, and then the same for the Blazor app.

    3 out of 10 times I start it like this the WebAPI is actively refusing the connection, then I have close the browser tabs down and redo it.

    7 out of 10 times I can get my Blazor app to return data, and then I make some changes to it and once I hit save the Blazor app is attempting to refresh the connection but fails. Then I need to close that tab and do a CTRL5.

    What am I missing here? This cannot be this cumbersome, right.?

    Wednesday, February 17, 2021 3:18 PM

All replies

  • User475983607 posted

    I think you might be a bit impatient.   I'll assume you are hosting Web API in IIS Express.  Typically ctrl-F5 is good for a long time.  Even after a compiling code.  You just need to wait for the code to compile.  The browser has nothing to do with the process.  There are times when IIS Express stops and I have to restart the app but I've never experienced a situation where ctrl-F5 work 30% of the time.  

    I typically host development Core/5.0 applications in the console with the the watch option. 

    dotnet run watch


    The "watch" option looks for files changes and compiles when a file change is detected.  If there are no errors, then host is usually up and running before I can start switch to the browser. 

    Wednesday, February 17, 2021 7:48 PM