使用WebpackDevMiddleware AggregateException

问题描述 投票:1回答:1

我尝试使用NPM / Webpack / Vue.js创建ASP.NET Core MVC应用程序。我正在学习本教程:https://marczak.io/posts/netcore-vuejs/

启动项目时,我得到以下异常:

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)

异常发生在Configure方法的Startup.cs中:

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

好像有些JSON文件格式错误了?!但是哪一个。我是NPM和Webpack的新手。

如果您需要更多信息,请与我们联系。

c# webpack asp.net-core-mvc
1个回答
1
投票

发现这个dotnet问题:https://github.com/dotnet/core/issues/1726

我在代理后面,需要停用它(我不能)或在Program.cs的Main()方法中添加此行之前的其他内容:

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

相关问题