Sam*_*war 4 asp.net-core-mvc .net-core asp.net-core asp.net-core-1.0
我正在尝试将我的asp.net核心1.0.0 RC1应用程序迁移到最终1.0.0并在其他帖子的帮助下我设法将所有引用从RC1更改为最终1.0.0但仍然有几个错误仍然是我无法找到合适的替代方法或参考文献
app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());
Run Code Online (Sandbox Code Playgroud)
错误CS1061'IOpplicationBuilder'不包含'UseIISPlatformHandler'的定义,并且没有可以找到接受类型'IApplicationBuilder'的第一个参数的扩展方法'UseIISPlatformHandler'(您是否缺少using指令或程序集引用?)
我"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0"在project.json中
services.AddEntityFramework().AddSqlServer()
.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
Run Code Online (Sandbox Code Playgroud)
错误CS1061'IServiceCollection'不包含'AddEntityFramework'的定义,并且没有可以找到接受类型'IServiceCollection'的第一个参数的扩展方法'AddEntityFramework'(您是否缺少using指令或程序集引用?)
我 "Microsoft.EntityFrameworkCore": "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",在project.json中
请有人帮我解决这些问题吗?提前致谢.
对于第一期,
删除app.UseIISPlatformHandler行并添加UseIISIntegration()Main方法,如下所示 -
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration() // Replaces call to UseIISPlatformHandler
.UseStartup<Startup>()
.Build();
host.Run();
}
Run Code Online (Sandbox Code Playgroud)
第二期,
用services.AddEntityFrameworkSqlServer()而不是services.AddEntityFramework().AddSqlServer()
参考文献:
从ASP.NET 5 RC1迁移到ASP.NET Core 1.0 https://docs.asp.net/en/latest/migration/rc1-to-rtm.html
从ASP.NET Core RC2迁移到ASP.NET Core 1.0 https://docs.asp.net/en/latest/migration/rc2-to-rtm.html
看看这是否有帮助.
| 归档时间: |
|
| 查看次数: |
2679 次 |
| 最近记录: |