简体   繁体   English

Ninject no kernel 已为 web 应用程序注册

[英]Ninject no kernel has been registered for the web application

I just inherited a program that is written in Framework 4.8.我刚刚继承了一个用 Framework 4.8 编写的程序。 This is an asp.net application.这是一个 asp.net 应用程序。 When we try to hit a login page on our site we get this error:当我们尝试在我们的网站上点击登录页面时,我们会收到此错误:

Event code: 3005 Event message: An unhandled exception has occurred.事件代码:3005 事件消息:发生未处理的异常。 Event time: 2/26/2021 11:35:59 AM Event time (UTC): 2/26/2021 6:35:59 PM Event ID: a930ec5b24ce461cb7ea325a5a3df94d Event sequence: 10 Event occurrence: 5 Event detail code: 0事件时间:2/26/2021 11:35:59 AM 事件时间 (UTC):2/26/2021 6:35:59 PM 事件 ID:a930ec5b24ce461cb7ea325a5a3df94d 事件顺序:10 事件发生:5 事件详细代码:0
Application information: Application domain: /LM/W3SVC/2/ROOT/ControlRoom-1-132588368625020589 Trust level: Full Application Virtual Path: /ControlRoom Application Path: [path to app] Machine name: 945597-PREVIDEN Process information: Process ID: 2680 Process name: w3wp.exe Account name: IIS APPPOOL\login.controlroom Exception information: Exception type: InvalidOperationException Exception message: The type ASP.usercontrols_usernamepasswordlogin_ascx requested an injection, but no kernel has been registered for the web application.应用程序信息: 应用程序域:/LM/W3SVC/2/ROOT/ControlRoom-1-132588368625020589 信任级别:完整应用程序虚拟路径:/ControlRoom 应用程序路径:[path to app] 机器名:945597-PREVIDEN 进程信息:进程ID: 2680 Process name: w3wp.exe Account name: IIS APPPOOL\login.controlroom Exception information: Exception type: InvalidOperationException Exception message: The type ASP.usercontrols_usernamepasswordlogin_ascx requested an injection, but no kernel has been registered for the web application. Please ensure that your project defines a NinjectHttpApplication.请确保您的项目定义了一个 NinjectHttpApplication。 at Ninject.Web.KernelContainer.Inject(Object instance) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at Ninject.Web.KernelContainer.Inject(Object instance) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive (Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web .UI.Page.ProcessRequestMain(布尔型 includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)

 Request information: Request URL: [url]Login.aspx?ReturnUrl=/controlroom Request path: /ControlRoom/Login.aspx User host address: [host IP] User: Is authenticated: False Authentication Type: Thread account name: IIS APPPOOL\login.controlroom Thread information: Thread ID: 62 Thread account name: IIS APPPOOL\login.controlroom Is impersonating: False Stack trace: at Ninject.Web.KernelContainer.Inject(Object instance) at System.Web.UI.Control.InitRecursive(Control

namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI .Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I have tried resetting the application pool, redeploying the site and even doing a restart of the whole server but it continues to fail.我尝试过重置应用程序池,重新部署站点,甚至重新启动整个服务器,但它仍然失败。 I have no experience with Ninject and I am clueless as to what can be the problem or the solution.我没有使用 Ninject 的经验,也不知道可能是什么问题或解决方案。 The main site that hosts this page is working, it is just this page that is failing.托管此页面的主站点正在运行,只是此页面出现故障。 I can provide code if needed but I don't know what would be useful at this time.如果需要,我可以提供代码,但我不知道此时会有什么用处。 The site is using Ninject 3.2.0该站点正在使用 Ninject 3.2.0

This was actually a problem with the connection string in the web.config file.这实际上是 web.config 文件中的连接字符串有问题。 Once we pointed it to the right location, it started working again.一旦我们将它指向正确的位置,它就会再次开始工作。 It had nothing to do with the Ninject, that was where the error was captured and thrown which in turn, threw us off the actual problem.它与 Ninject 无关,这是错误被捕获并抛出的地方,这反过来又让我们摆脱了实际问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 报告查看器 Web 控件 HTTP 处理程序尚未在应用程序的 web.config 文件中注册 - The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file 如何解决“报告查看器 Web 控件 HTTP 处理程序尚未在应用程序的 web.config 文件中注册” - How to resolve "The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file" ASP.NET 4.0尚未在Web服务器上注册错误 - ASP.NET 4.0 has not been registered on web server error ASP.NET 4.5.512尚未在Web服务器上注册 - asp.net 4.5.512 has not been registered on the web server 检查用户名是否已注册 - Check if a username has been registered 尝试使用VS 2012打开我的asp.net 4.5 MVC Web应用程序时出错.Asp.net尚未在服务器上注册 - Error when trying to open my asp.net 4.5 MVC web application using VS 2012. Asp.net has not been registered on the server 没有注册类型“类型”的服务 - No service for type 'Type' has been registered 自有服务 - 没有注册类型服务 - Own service - no service for type has been registered 如何在ASP.NET应用程序中存储Ninject内核? - How to store Ninject Kernel in an ASP.NET Application? Ninject Web应用程序:所有绑定都应该是InRequestScope()? - Ninject Web Application: All bindings should be InRequestScope()?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM