【发布时间】:2017-08-23 12:08:13
【问题描述】:
我有一个相对复杂的项目,它是 .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:
有人可以帮忙吗?
【问题讨论】:
-
错误 500 表示内部服务器错误。您确实应该不在 Web 部件上找到任何有用的东西。你必须检查你的服务器的日志。
-
我在本地运行这个项目。
-
所以,检查你本地机器的日志。如果您使用 IIS (Express) 运行 - 请参阅 this question,如果您仅使用 Kestrel 运行 - 检查控制台输出。
标签: asp.net-core asp.net-core-2.0