以下是我的应用程序的一些详细信息以及出现的错误:
.NetCore Version : 2.0
Exception File name : Startup.cs
line number : 41 UseWebpackDevMiddleware()
包装参考:
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
<PackageReference Include="Microsoft.PowerBI.Api" Version="2.0.12" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.3" />
堆栈跟踪:
System.TypeLoadException
HResult=0x80131522
Message=Could not load type 'System.Runtime.Serialization.SerializationBinder'
from assembly 'netstandard, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51'.
Source=Newtonsoft.Json
StackTrace:
at Newtonsoft.Json.JsonSerializer..ctor()
at Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings settings)
at Microsoft.AspNetCore.Builder.WebpackDevMiddleware.UseWebpackDevMiddleware(IApplicationBuilder appBuilder, WebpackDevMiddlewareOptions options)
at WebUI.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env) in
F:\code\UI\WebUI\Startup.cs:line 41
这是我的自定义nuget项目的一些细节:
Application Framework : .net Framework 4.6.1
包装信息:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.ApplicationInsights" version="2.6.4" targetFramework="net461" />
<package id="Microsoft.Azure.KeyVault" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net461" />
<package id="Microsoft.Azure.KeyVault.WebKey" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Azure.ServiceBus.EventProcessorHost" version="2.2.10" targetFramework="net461" />
<package id="Microsoft.Azure.Services.AppAuthentication" version="1.1.0-preview" targetFramework="net461" />
<package id="Microsoft.Azure.WebJobs" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Azure.WebJobs.Core" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Azure.WebJobs.ServiceBus" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Data.Edm" version="5.6.4" targetFramework="net461" />
<package id="Microsoft.Data.OData" version="5.6.4" targetFramework="net461" />
<package id="Microsoft.Data.Services.Client" version="5.6.4" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.1.1" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="3.19.8" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Logging" version="5.2.2" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Protocols" version="5.2.2" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="5.2.2" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Tokens" version="5.2.2" targetFramework="net461" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net461" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.11" targetFramework="net461" />
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.12" targetFramework="net461" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
<package id="NETStandard.Library" version="1.6.1" targetFramework="net461" />
<package id="Newtonsoft.Json" version="10.0.1" targetFramework="net461" />
<package id="StackExchange.Redis" version="1.2.6" targetFramework="net461" />
<package id="StyleCop.MSBuild" version="4.7.49.1" targetFramework="net461" developmentDependency="true" />
<package id="System.AppContext" version="4.3.0" targetFramework="net461" />
<package id="System.Collections" version="4.3.0" targetFramework="net461" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
<package id="System.Console" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.4.0" targetFramework="net461" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net461" />
<package id="System.Globalization" version="4.3.0" targetFramework="net461" />
<package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net461" />
<package id="System.IdentityModel.Tokens.Jwt" version="5.2.2" targetFramework="net461" />
<package id="System.IO" version="4.3.0" targetFramework="net461" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net461" />
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net461" />
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Linq" version="4.3.0" targetFramework="net461" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
<package id="System.Net.Http" version="4.3.0" targetFramework="net461" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net461" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net461" />
<package id="System.Spatial" version="5.6.4" targetFramework="net461" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net461" />
<package id="System.Threading" version="4.3.0" targetFramework="net461" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net461" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net461" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" />
<package id="WindowsAzure.ServiceBus" version="3.4.5" targetFramework="net461" />
<package id="WindowsAzure.Storage" version="7.2.1" targetFramework="net461" />
</packages>
在包含上述详细内容之后,.netCore
Web应用程序在UseWebpackDevMiddleware
中的startup.cs
处引发了异常。
该怎么办?
答案 0 :(得分:0)
您不应将UseWebpackDevMiddleware
用于library reference
。对于Nuget Reference
,您需要通过Nuget引用它,或将其添加到.csproj
内容中。他们将在构建项目时解决。
UseWebpackDevMiddleware
使用web pack
这是现代JavaScript应用程序的静态模块捆绑器来打包static files reference
,如javascript
,css
等。