I just inherited a program that is written in Framework 4.8. This is an asp.net application. 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. 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
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. Please ensure that your project defines a 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)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)
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. 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
This was actually a problem with the connection string in the web.config file. 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.