0
votes

I have frustrating problem in my web application. When I tested app local i didnt have any exception, when i published app, then throw a many null exception or like "Object reference not set to an instance of an object.". I don't understand why. I use hosting http://1and1.pl/. Can anybody help me?

Stack trace:

[NullReferenceException: Object reference not set to an instance of an object.] QuestionnaireEx.Controllers.QuestionnaireController.TestStart(AttemptAnswers attA, String prevBtn) +7267 lambda_method(Closure , ControllerBase , Object[] ) +119 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +182 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +27 System.Web.Mvc.Async.<>c_DisplayClass42.b_41() +28 System.Web.Mvc.Async.<>c_DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _) +10 System.Web.Mvc.Async.WrappedAsyncResult1.End() +50 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32 System.Web.Mvc.Async.<>c_DisplayClass39.b_33() +58 System.Web.Mvc.Async.<>c_DisplayClass4f.b_49() +225 System.Web.Mvc.Async.<>c_DisplayClass4f.b_49() +225 System.Web.Mvc.Async.<>c_DisplayClass37.b_36(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResult1.End() +50 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34 System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24 System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +99 System.Web.Mvc.Async.WrappedAsyncResult1.End() +50 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27 System.Web.Mvc.<>c_DisplayClass1d.b_18(IAsyncResult asyncResult) +14 System.Web.Mvc.Async.<>c_DisplayClass4.b_3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult1.End() +55 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult1.End() +55 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 System.Web.Mvc.<>c_DisplayClass8.b_3(IAsyncResult asyncResult) +25 System.Web.Mvc.Async.<>c_DisplayClass4.b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629296 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

1
Anything in the fusion or windows logs?Preet Sangha
thats all, i can add that this exception occur in random casesmatiii
Can you show the TestStart action code?devdigital
In which case you need add logging to narrow down what's happening. Essentially you need to be able to create a scenario that's repeatable. When you random, what do you mean? What about the data? Is this the same on both sites?Preet Sangha
The random means that the exception in the some case one occur the next time doesnt. Maybe this a problem server no code or database ? Link to action: linkmatiii

1 Answers

0
votes

Make sure that the local configuration is the same as the server you're using.

For example, if you're hosting in IIS, set up a local IIS server with the same settings as on your remote server.

If your 1and1 hosting is shared, then look at your local configuration, and get on the phone with 1and1 support to see what the differences are between the local and remote configuration.

It's possible that you'll have to upgrade to a VPS or Dedicated server depending on your configuration needs.

Edit

Will you please post the source of the mvc controller method that is being called? Also, the values of each member in the method when it runs on the server? That would help in the process of evaluating your question.

Also,

I just realized that lambda_method(Closure , ControllerBase , Object[] ) +119 is on the second line of the stack trace.

If the error is being thrown from a lambda expression it may be that the iteration item that you're using in the lambda method is set to null at some point. If you don't check for null in your lambda expression, try that. It's just a guess, but without source code, all we've got are guesses.