For some reason after deploying the same code that works perfectly on localhost to my server this line fails:
private static string nodePath = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["NodeJS.Path"]);
The original exception is System.TypeInitializationException
: The type initializer for 'Turcos.App.Components.AsyncFileExporter' threw an exception. But it's clear to see that the exception is thrown because HttpContext.Current
is null.
I understand that HttpContext.Current
can be null sometimes (https://stackoverflow.com/a/6861575/1519464) but why it's working on my local and not on the server? What's even more weird is that the code that I prevously had on my server was using HttpContext.Current
and it worked perfectly. What could have changed that stoped this from working?