Connection string is not retreiving from Web.Config fileHai Friends,
I am creating a web service and for the connection string, i m keeping in the Configuration file- Web.Config as below:
<add connectionString="NBAConnectionString" name="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=NEWBQA;Data Source=NLGTNBASQL09"/>
Now I am writing the code to access this connection string in my Service.asmx.cs as shown below:
using (sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["NBAConnectionString"].ConnectionString.ToString()))
while execution, its displaying the "object reference doesn't set to instance of objects" message.
I am trying to consume this service from a Console application. So while keeping the breakpoint, its not accessing any element of the Web.Config file.
Even i kept few key value pair under the AppSettings, those also not accessible.
Any suggestion please.