ASP.NET核心RC1到1.0.0迁移错误
我想将我的asp.net核心1.0.0 RC1应用程序迁移到最终的1.0.0和其他职位的帮助下,我设法将所有引用从RC1更改为最后1.0.0 但还是有几个错误的仍然是我不能找到合适的替代方法或引用ASP.NET核心RC1到1.0.0迁移错误
app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());
错误CS1061“IApplicationBuilder”不包含“UseIISPlatformHandler”,没有扩展方法的定义 'UseIISPlatformHandler'接受类型为 'IApplicationBuilder'的第一个参数可能是(是否缺少using 指令或程序集引用?)
我project.json有"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0"
services.AddEntityFramework().AddSqlServer()
.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
错误CS1061 'IServiceCollection' 不包含一个定义'AddEntityFramework'并且没有扩展方法'AddEntityFramework' 接受类型'IServiceCollection'的第一个参数可以被发现 (你是否缺少使用指令或程序集引用?)
我已经"Microsoft.EntityFrameworkCore": "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
在project.json
请任何人都可以帮我解决这些问题? 在此先感谢。
对于第一个问题,
删除app.UseIISPlatformHandler
线和主要方法中添加UseIISIntegration()
像如下─
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration() // Replaces call to UseIISPlatformHandler
.UseStartup<Startup>()
.Build();
host.Run();
}
对于第二个问题,
使用services.AddEntityFrameworkSqlServer()
而不是services.AddEntityFramework().AddSqlServer()
参考:
从ASP.NET 5 RC1迁移到ASP.NET 1.0的核心 https://docs.asp.net/en/latest/migration/rc1-to-rtm.html
从ASP.NET核心RC2迁移到ASP.NET 1.0的核心 https://docs.asp.net/en/latest/migration/rc2-to-rtm.html
看看这会有所帮助。
谢谢Sanket这些问题现在已经解决。 –
我建议使用单独的用户帐户创建一个新的Web应用程序,然后将新项目与当前项目进行比较,以查看发生了什么变化。在最新的,你会得到一个Program.cs文件和IIS集成去那里,而不是启动 –