WebService LocalSQLServer Help

G

Giovanni

Dear Friends,

How are you? I am stuck on a problem and I just can't figure it out:
I have 1 ASP.NET/VB.NET 2.0 WebService that currently provides user
registration and authentication using the Membership and Roles classes,
etc... Everything works well so far. I modified the WebService's
"LocalSQLServer" web.config value to point to a remote SQL 2005 server.

My "Credentials" WebService needs to connect to other remote SQL Server
2005 databases to provide registration and authentication for separate
applications for various customers; in essence, each remote server/database
represents a different customer (their request). Here is my problem: Is
there any way (in code) that I can pass my WebService the "LocalSQLServer"
(MembershipProvider connectionStringName) value while it is initializing
instead of picking it up automatically from the web.config file?

In essence, how can 1 WebService connect to multiple (remote) SQL
Server 2005 databases stored on different servers since the LocalSQLServer
connection string can only contain 1 value at any given time?


Regards,

Giovanni P.
 
R

Ramya A

You can specify multiple key values in the Web.Config each pointing to
the various remote servers you would want to connect.
Could this work?
 
G

Giovanni

I don't know if I can, but even if I were able to, I would need to pass in
one of these key values upon initialization of the WebService. From what I
can deduce, the WebService automatically connects to the "LocalSQLServer"
node in the web.config file when it initializes itself. I need to pass this
value from each individual application as it starts up.


Regards,

Giovanni
 
R

Ramya A

This is what I was suggesting, here's a code snippet from Web.config
file:
<appSettings>
<add key="Server1"
value="Server=FC000XSTEST1;UID=TEST1;PWD=test1;Database=TEST1;"/>
<add key="Server2"
value="Server=FC000XSTEST2;UID=TEST2;PWD=test2;Database=TEST2;"/>
</appSettings>

You can then utilize the Configuration namespace and retrieve the value
for
Server1 or Server2 whenever the need be. So the web service does not
connect to
anything by default.
Hope this helps
Ramya
 
R

Ramya A

This is what I was suggesting, here's a code snippet from Web.config
file:
<appSettings>
<add key="Server1"
value="Server=FC000XSTEST1;UID=TEST1;PWD=test1;Database=TEST1;"/>
<add key="Server2"
value="Server=FC000XSTEST2;UID=TEST2;PWD=test2;Database=TEST2;"/>
</appSettings>

You can then utilize the Configuration namespace and retrieve the value
for
Server1 or Server2 whenever the need be. So the web service does not
connect to
anything by default.
Hope this helps
Ramya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,108
Latest member
AlbertEste
Top