C
cssnow
I have a web service with a connection string in the appSettings of my
web.config file. The beginning of the config looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ABConnectionString"
value="server=localhost;database=VueBay;uid=sa;pwd=lonewolf"/>
</appSettings>
<system.web>
....
I can run my service with the forms that ASP.NET creates by sticking
the path for my service in a browser like this:
http://localhost/ABPopulateAccountService/PopulateAccount.asmx. It
works great. I also have a test client from which I call the web
methods. It doesn't works so great. My client calls the same
service, but can't read the appSettings for some reason. When I run
the client my webservice returns strConn = null from the following
line:
string strConn = ConfigurationSettings.AppSettings["ConnectionString"];
whereas the ASP.NET forms return my connection string. It seems to me
that since they are both running the same service they ought to give me
the same result. Unfortunately, ASP.NET isn't telling me much about
what is going on when I run my client. I can remove the config file,
change the contents of it, fill it with errors and it does exactly the
same thing; it returns a null in my string. I can't even be sure
that ASP.NET is finding the web.config. I've tried moving the config
around within my directory structure. It doesn't make any difference
where it is. I've seen some others on the message boards complaining
about this, but have yet to see a definitive reason why this happens.
Any thoughts?
Rob
web.config file. The beginning of the config looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ABConnectionString"
value="server=localhost;database=VueBay;uid=sa;pwd=lonewolf"/>
</appSettings>
<system.web>
....
I can run my service with the forms that ASP.NET creates by sticking
the path for my service in a browser like this:
http://localhost/ABPopulateAccountService/PopulateAccount.asmx. It
works great. I also have a test client from which I call the web
methods. It doesn't works so great. My client calls the same
service, but can't read the appSettings for some reason. When I run
the client my webservice returns strConn = null from the following
line:
string strConn = ConfigurationSettings.AppSettings["ConnectionString"];
whereas the ASP.NET forms return my connection string. It seems to me
that since they are both running the same service they ought to give me
the same result. Unfortunately, ASP.NET isn't telling me much about
what is going on when I run my client. I can remove the config file,
change the contents of it, fill it with errors and it does exactly the
same thing; it returns a null in my string. I can't even be sure
that ASP.NET is finding the web.config. I've tried moving the config
around within my directory structure. It doesn't make any difference
where it is. I've seen some others on the message boards complaining
about this, but have yet to see a definitive reason why this happens.
Any thoughts?
Rob