DoubleVoid
DoubleVoid

Reputation: 795

UseWebpackDevMiddleware AggregateException

I try to create a ASP.NET Core MVC application using NPM/Webpack/Vue.js. I am following this tutorial: https://marczak.io/posts/netcore-vuejs/

When starting the project I get this exception:

An exception of type 'System.AggregateException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'One or more errors occurred.'
 Inner exceptions found, see $exception in variables window for more details.
 Innermost exception     Newtonsoft.Json.JsonReaderException : Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonTextReader.Read()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)

The Exception occurs in the Startup.cs in the Configure method:

        app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
        {
            HotModuleReplacement = true
        });

Seems like some JSON file is malformed?! But which one. I am new to the NPM and Webpack stuff.

If you need any more information, let me know.

Upvotes: 1

Views: 677

Answers (1)

DoubleVoid
DoubleVoid

Reputation: 795

Found this dotnet issue: https://github.com/dotnet/core/issues/1726

I am behind a proxy and need to deactivate it (which I can't) or add this line in the Main() method of Program.cs before anything else:

AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);

Upvotes: 1

Related Questions