asp.net core - Angular 4 throwing error EventSource's response has a MIME type ("text/html") that is not "text/event-stream" after migrating to .NetCore 2.0 -




i have existing spa based on asp .net core (i using yo generator-aspnetcore-spa generate template). worked fine, after migration .netcore 2.0 started throw error:

eventsource's response has mime type ("text/html") not "text/event-stream". aborting connection.

as understood problem affects auto-refresh after updating file (hot module replacement far know). other stuff working fine.

so, question how fix error above?

i found solution, problem in .netcore routing system, taking on , trying handle request, returning text/html, it's sending actual webpack_hmr hot file. fix need edit configure method in startup.cs file.

  1. before:

    // code app.usewebpackdevmiddleware(new webpackdevmiddlewareoptions {             hotmodulereplacement = true                             }); //some code 
  2. after:

    // code app.usewebpackdevmiddleware(new webpackdevmiddlewareoptions {             hotmodulereplacement = true,             hotmodulereplacementendpoint = "/dist/__webpack_hmr"                            }); // code 

the solution taken thread on github





wiki

Comments

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

python - Minimize function with Scipy minimize -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -