我有一个相对复杂的项目,即.net core 1.1( .net framework )。
选择.Net Framework是数据库的原因是Oracle和Core Framework不支持Oracle实体数据模型。无论如何,该应用程序在生产中已经运行了大约一年了。
我正在尝试将此项目升级到.net core 2。根据文档here我修改了Startup中的Authentication寄存器,项目编译。
旧代码:
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
AuthenticationScheme = "Administration",
LoginPath = new PathString("/Login/"),
AccessDeniedPath = new PathString("/Login/"),
AutomaticAuthenticate = true,
CookieSecure = CookieSecurePolicy.SameAsRequest,
AutomaticChallenge = true
});
更新代码:
app.UseAuthentication();
services.AddAuthentication("Administration").AddCookie(options =>
{
options.LoginPath = new PathString("/Login/");
options.AccessDeniedPath = new PathString("/Login/");
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
});
我收到错误页面500:
有人可以帮忙吗?
答案 0 :(得分:1)
查看stdout日志后,问题是ConfigureServices只能接受IServiceCollection。我试图注入另一个参数,但项目编译。