I have a class called LocalConstants ....
public static class LocalConstants { public static string DM_PATH = ConfigurationManager.AppSettings["DMQueue"]; public static string PROJECT_PATH = ConfigurationManager.AppSettings["MSQueue"]; }
When I try to access this class in my main program, I get an exception for null reference. Everything from ConfigurationManager.AppSettings [is always null. But if I write
//The value is returned fine string bo=ConfigurationManager.AppSettings["MSQueue"];
this one compiles fine, but always null and throws a NullRefexception
string moomoo = LocalConstants.PROJECT_PATH;
An exception is the Type Initializer for "TestCodeOutOnSide.LocalConstants" made an exception.
An internal exception is the main Object reference not set to the object instance.
Even if I changed PROJECT_PATH to
public static readonly string PROJECT_PATH = @"FORMATNAME:DIRECT=OS:serus-nickl\RMQDEV";
I get the same exception
Any ideas?
source share