gpt4 book ai didi

c# - .NET Core 1.1 项目启动时 Microsoft.AspNetCore.Server.Kestrel 中的 TypeLoadException

转载 作者:太空宇宙 更新时间:2023-11-03 23:02:47 25 4
gpt4 key购买 nike

我们正在尝试将我们的 .Net 4.5 项目 (Web-Api) 移植到 .Net Core。

它对除我以外的每个开发人员都运行良好。此外,我们最近切换到 VS 2017 RC。

程序启动但在第一个请求时崩溃:

-InnerException {System.TypeLoadException: Method 'get_ContentLength' in type 'Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameRequestHeaders' 
from assembly 'Microsoft.AspNetCore.Server.Kestrel, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.Reset()
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.Start()
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Connection.Start()
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.ListenerPrimary.DispatchConnection(UvStreamHandle socket)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.TcpListenerPrimary.OnConnection(UvStreamHandle listenSocket, Int32 status)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.ConnectionCallback(UvStreamHandle stream, Int32 status, Exception error, Object state)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvStreamHandle.UvConnectionCb(IntPtr handle, Int32 status)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.NativeMethods.uv_run(UvLoopHandle handle, Int32 mode)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.run(UvLoopHandle handle, Int32 mode)
at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelThread.ThreadStart(Object parameter)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelThread.<StopAsync>d__45.MoveNext()} System.Exception {System.TypeLoadException}

我尝试了不同版本的 Microsoft.AspNetCore.Server.Kestrel 无济于事。删除并重置我所知道的 VS 的每个缓存并重新安装 .NET Core 和 VS 2017 RC

项目文件:

  <ItemGroup>
<PackageReference Include="adremes.Common" Version="1.3.0" />
<PackageReference Include="adremes.Data" Version="3.0.1" />
<PackageReference Include="AutoMapper" Version="5.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Server" Version="0.2.0-preview2-22683" />
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="1.1.0-preview1-23121" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="1.1.0" />
<PackageReference Include="DocumentFormat.OpenXml" Version="2.7.1" />
<PackageReference Include="AspNet.Security.OpenIdConnect.Server" Version="1.0.0-beta7-final" />
<PackageReference Include="AspNet.Security.OAuth.Validation" Version="1.0.0-alpha3-final" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.1" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
</ItemGroup>

最佳答案

问题已通过恢复解决

<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="1.1.0-preview1-23121" />

回到

<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="1.0.0" />

问题在稳定的 1.1.0 版本中仍然存在。

为什么它适用于某些开发人员而不适用于其他开发人员,这仍然是一个谜。

关于c# - .NET Core 1.1 项目启动时 Microsoft.AspNetCore.Server.Kestrel 中的 TypeLoadException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42491515/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com