I have created a WCF service and added the same as Service reference in another Windows application. It is working fine there. I have created a website and added the as project reference to the Service. Then, while trying to browse the svc file in a browser, its throws an error at my ConnectionString.
public SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["TestConnection"].ToString());
The error message is Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
What may be the possible error? Please help.
I have found the problem. Since I’m using that Windows and WCF Service, I need to have specify that in the web.config of service too. Adding the
<appSettings>tag in the web.config tag resolve my issue. I’m not sure whether this is a correct method or not, but it did made a smile in my face. 🙂