I get the Object reference not set to an instance of an object (shows line number of catch (Exception ex) when the controller.Execute() command is executed. I am using the AcceuptUI.js process.
I can use production credentials and step through Visual Studio code (c#) and the controller.Execute() command executes fine with no issues. Everything shows up on Authorize.Net's end emails are sent just like expected. But once I push code to my server for production I get the error shown below.
I can run test code with Sandbox credentials from the same server with no issues.
Is there an IIS issue or setting I am missing to execute this line of code in production? Below is the error I receive.
Thanks
Rick
[NullReferenceException: Object reference not set to an instance of an object.] MainSite.Controllers.OnlineRegistrationController.NewAuthResponse(FormCollection fc) in C:\BreakpointTech\Development\cfaerp\MainSite\Controllers\OnlineRegistrationController.cs:1690 lambda_method(Closure , ControllerBase , Object[] ) +104 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +157 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27 System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22 System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32 System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50 System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +228 System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34 System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26 System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100 System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27 System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36 System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9874049 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +159
Solved! Go to Solution.
03-15-2019 04:51 AM
Problem solved!
I figured there was a library issue of some sort based on how prod worked locally and the development site on the cloud server worked too. Sure enough the updated dlls from Authorize.Net were not published during a Microsoft VS (2017) publish. My development site on the server had the new dlls but production did not. This is kind of an issue with the Microsoft Publishing process, sometimes not all updates get published. ???
I updated the dlls to the correct ones and now the controller.Execute() command is working correctly.
Thanks for your help!
Rick
03-19-2019 05:05 AM
Not a C# expert but a quick glance at the error looks like you may have an absolute file path tied to the C: drive on your local machine.
C:\BreakpointTech\Development\cfaerp\MainSite\Controllers\OnlineRegistrationController.cs
03-16-2019 12:18 PM
The path shows where the application is blowing up. It is blowing up in my OnlineRegistrationController. The code that is blowing up is controller.Execute(); The code works on my server using test credentials so this is bizare to me. I don't think the path is an issue.
03-17-2019 03:40 PM
Yeah I got that. You were saying that you pushed the code to your server for production and you get the error. I assumed you meant a remote server and I do not use IIS. It is not typical for linux servers to have a C drive, which is why that looked odd to me.
03-17-2019 08:46 PM
I can see why that line sticks out as a possible issue but and have seen that before for other issues. This one just seems like the error is not matching what really is going on since the same code works in my development website that runs on the same server. The only difference is the test credentials.
I feel like this is a setting of some sort on the (Authorize.Net) production account. Would there be an issue if I have the Response/Receipt URL filled in? That url needs to be there for current production neeeds. And becuase the controller.Execute() command does not blow up when execute the code locally I did not think this would be an issue.
Any other ideas?
Thanks
Rick
03-18-2019 05:23 AM
03-18-2019 08:25 AM - edited 03-18-2019 08:27 AM
Problem solved!
I figured there was a library issue of some sort based on how prod worked locally and the development site on the cloud server worked too. Sure enough the updated dlls from Authorize.Net were not published during a Microsoft VS (2017) publish. My development site on the server had the new dlls but production did not. This is kind of an issue with the Microsoft Publishing process, sometimes not all updates get published. ???
I updated the dlls to the correct ones and now the controller.Execute() command is working correctly.
Thanks for your help!
Rick
03-19-2019 05:05 AM