0

I deployed asp.net core application of Digital Ocean server Ubuntu 16.04 nginx server.

The way I am doing is to publish it at my local machine, get all the dlls uploaded and then run below command:

dotnet applcationname.dll

It runs without any problem and continues until this comes:

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

This error can be eliminated with the code change and that I am fixing in the meantime but the question is each time if any error or exception will come and dotnet will stop and then I have to get up mid of the night to run it seems unviable solution.

I think I am missing some workaround where errors can be logged and application should never go die until we say to.

Please help me folks.

Jaidev Khatri
  • 159
  • 4
  • 15
  • That's a *serious* bug in the code itself. It's also easy to fix by debugging. Add proper exception handling and logging and log the full exception message, including the call stack. This will show you where the error was thrown – Panagiotis Kanavos Feb 13 '18 at 14:10
  • BTW it's impossible for anyone to help beyond that since you didn't post the code or any information about it. `application should never go die until we say to.` – Panagiotis Kanavos Feb 13 '18 at 14:11
  • [Debugging ASP Core on Linux with Visual Studio 2017](https://blogs.msdn.microsoft.com/premier_developer/2017/11/10/debugging-asp-core-on-linux-with-visual-studio-2017/) – idubnori Feb 13 '18 at 14:13
  • PS before you post the code, read [What is NullReferenceException and how do I fix it](https://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it). The question will be closed as duplicate unless you can show that the issue isn't answered by that question, that you *did* debug your code, *did* check the exception call stack and the exception wasn't thrown because some field or variable was null – Panagiotis Kanavos Feb 13 '18 at 14:14
  • I am pretty much clear about the error, that I am fixing. I am just comparing Shared Hosted traditional dotnet with this one, hope you understood. One thing that is correct. I have to put exception handling to avoid this which is quite acceptable. – Jaidev Khatri Feb 13 '18 at 14:16
  • @PanagiotisKanavos Understood your point clearly, have put exceptional handling and it is not crashing now. – Jaidev Khatri Feb 13 '18 at 15:04

0 Answers0