我们正在尝试将.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>
答案 0 :(得分:2)
通过还原
解决了这个问题<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="1.1.0-preview1-23121" />
回到
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="1.0.0" />
稳定的1.1.0版本仍然存在问题。
为什么它对某些开发人员起作用而不是为他人服务仍然是一种谜。
答案 1 :(得分:1)
花了几个小时试图解决这个问题。解决方案正在更新到
"Microsoft.AspNetCore.Authentication.Google": "1.1.1"
在project.json中。看似完全独立的包裹。如果有人被困,我会尝试搞乱其他依赖。