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.
before:
// code app.usewebpackdevmiddleware(new webpackdevmiddlewareoptions { hotmodulereplacement = true }); //some code
after:
// code app.usewebpackdevmiddleware(new webpackdevmiddlewareoptions { hotmodulereplacement = true, hotmodulereplacementendpoint = "/dist/__webpack_hmr" }); // code
the solution taken thread on github
wiki
Comments
Post a Comment