添加依賴項和更新模型類後,使用EF 7運行應用程序時出錯

asp.net-core-mvc entity-framework-core

我正在運行MVC 6和EF 7並且已經更改了我的模型並希望運行應用程序,但是我收到錯誤並且不清楚根本原因是什麼。

下面是我的project.json的片段

"dependencies": {
"EntityFramework.Commands": "7.0.0-beta5",
"EntityFramework.SqlServer": "7.0.0-beta5",
"Microsoft.AspNet.Antiforgery": "1.0.0-beta6",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta5",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta5",
"Microsoft.AspNet.Authentication.Google": "1.0.0-beta5",
"Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta5",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta5",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta5",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta5",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta5",
"Microsoft.AspNet.Mvc": "6.0.0-beta5",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta5",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta5",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
"Microsoft.AspNet.Session": "1.0.0-beta6",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta5",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta5",
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta5",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta5",
"Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta5",
"Microsoft.Framework.Logging": "1.0.0-beta5",
"Microsoft.Framework.Logging.Console": "1.0.0-beta5",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta5"
},

以下是網頁錯誤。

System.MissingMethodException未找到方法:'Boolean Microsoft.Framework.DependencyInjection.ServiceCollectionExtensions.TryAdd(Microsoft.Framework.DependencyInjection.IServiceCollection,Microsoft.Framework.DependencyInjection.ServiceDescriptor)。 Microsoft.AspNet.Loader.IIS.RuntimeHttpApplication.ApplicationStart上的Microsoft.AspNet.Hosting.WebHostBuilder.Build()中的Microsoft.AspNet.Hosting.WebHostBuilder.BuildHostingServices()上的Microsoft.Framework.DependencyInjection.LoggingServiceCollectionExtensions.AddLogging(IServiceCollection services) (IHttpApplication應用程序)在Microsoft.AspNet.Loader.IIS.HttpApplicationBase.InvokeApplicationStart(IHttpApplication應用程序)

一般承認的答案

從一個測試版到另一個測試版有很多重大變化。

因此,我建議您將project.json所有版本與beta5或beta6對齊。




許可下: CC-BY-SA with attribution
不隸屬於 Stack Overflow
這個KB合法嗎? 是的,了解原因
許可下: CC-BY-SA with attribution
不隸屬於 Stack Overflow
這個KB合法嗎? 是的,了解原因