[英]Not working index method in Asp.net core application
After long fight to publish my asp.net core app to webserver I finally did it and now everything working beside index method from admin controller which is specified as default. 经过长时间的努力,将我的asp.net核心应用发布到Web服务器之后,我终于做到了,现在一切都在管理控制器的索引方法(指定为默认值)旁边工作。
public IActionResult Index(int page = 1)
{
ViewBag.Title = "Admin Panel";
var model = new AdminViewModel()
{
Paging = new PaginationSettings()
{
ItemsPerPage = 4,
CurrentPage = page,
ShowFirstLast = true,
TotalItems = _newsData.GetAll().Count()
},
Category = _newsData.GetAllCats()
};
model.Newses = _newsData.Pagination(page);
return View(model);
}
Browser only throwing 500 error and saying that the website is not working. 浏览器仅抛出500错误,并说该网站无法正常工作。 If anybody know what to do pleas reply. 如果有人知道该怎么做,请答复。 //Edit: This is error from logfile: //编辑:这是日志文件中的错误:
warn: Microsoft.Extensions.DependencyInjection.DataProtectionServices[59] Neither user profile nor HKLM registry available. 警告:Microsoft.Extensions.DependencyInjection.DataProtectionServices [59]用户配置文件和HKLM注册表均不可用。 Using an ephemeral key repository. 使用临时密钥存储库。 Protected data will be unavailable when application exits. 当应用程序退出时,受保护的数据将不可用。 warn: Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository[50] Using an in-memory repository. 警告:Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository [50]使用内存中的存储库。 Keys will not be persisted to storage. 密钥将不会持久存储。
This is a bug in IIS, and it occurs when an application using DataProtection
is hosted in the Kestrel/IIS combination. 这是IIS中的错误,当在Kestrel / IIS组合中托管使用DataProtection
的应用程序时,会发生此错误。 It's putting your ephemeral keys into memory instead of the machine registry, which means they all get disposed when the app pool stops. 它会将您的临时密钥而不是计算机注册表存储在内存中,这意味着它们在应用程序池停止时都会被丢弃。
There is more discussion about this bug here . 有一个关于此错误的更多的讨论在这里 。 The problem seems to be solved by running this PowerShell script on the server. 该问题似乎可以通过在服务器上运行此PowerShell脚本来解决。 You can read a bit more about the script in this GitHub thread . 您可以在此GitHub线程中阅读有关脚本的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.