0

我的 ASP.NET MVC 3 应用程序在我的本地机器上运行良好(并且在我部署它时通常运行良好),但在这种情况下我收到以下错误。服务器是带有 IIS7 的 windows 2008 R2

编辑:Bothe ILoggingService 和 IConfigSettings 都被 Ninject 绑定在单例范围内(如果有帮助)

有人对我应该寻找什么有任何指示吗?

Object reference not set to an instance of an object. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[NullReferenceException: Object reference not set to an instance of an object.]
DataPortal.Models.Repositories.KpiRepository..ctor(ILoggingService ls, IConfigSettings configSettings) +1295
DynamicInjector3f592a0195c345d8a7d555c4c4085e12(Object[] ) +128
Ninject.Activation.Context.Resolve() +279
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +237
System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +298
System.Linq.WhereSelectArrayIterator`2.MoveNext() +109
System.Linq.Buffer`1..ctor(IEnumerable`1 source) +487
System.Linq.Enumerable.ToArray(IEnumerable`1 source) +103
Ninject.Activation.Providers.StandardProvider.Create(IContext context) +479
Ninject.Activation.Context.Resolve() +279
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +237
System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +298
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +67

[InvalidOperationException: An error occurred when trying to create a controller of type 'DataPortal.Controllers.KpiController'. Make sure that the controller has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +247
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +85
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +280
System.Web.Mvc.<>c__DisplayClass6.<BeginProcessRequest>b__2() +66
System.Web.Mvc.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a() +19
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func`1 func) +161
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +405
 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
4

3 回答 3

3

这最终是一个依赖问题。该项目依赖于另一个尚未部署的项目。

于 2012-05-10T08:18:12.150 回答
1

似乎您的参数之一“LoggingService 或 ConfigSettings”在您的 web.config 中未正确配置。检查您以前的工作版本配置文件。

于 2012-05-09T13:30:14.873 回答
0

在某些情况下,它可能与数据库问题有关,例如:

在没有正确异常处理的情况下返回空值的选择将导致相同的错误。因此,需要检查他的 sql 请求。

于 2020-12-18T22:14:39.577 回答