I have a basic web service running that accesses a database and returns XmlDocuments. The database access is defined in a web.config key.
I have multiple types of clients accessing these web services, and if lets say, a client of category 1 accesses the Web service, the WS needs to connect to Database1. ClientCategory2 -> Database 2 and so 开发者_JS百科on.
I can't edit the db access libraries themselves. All that is being done through a DLL and I don't have access to the code behind it.
So I guess what I want to know is, do I need to run multiple instances of basically the same service, but with different Web.config keys for each database that I have?
Thanks,
Teja.This isn't a question we can answer, it depends on the code that physically accesses the database. If it's coupled to 1 connection string yes you will need multiple applications. If the code provides an overloaded method that lets you specify which connection string to use or the connection string itself then you can use the single service.
You may specify multiple ConnectionStrings in your Web.config. Is this the key to which you are referring? Hopefully you'll find this MSDN link helpful: link text
you can specify multiple connection strings as said above. To make life easier you can name same as connStr1, connStr2 and then when client of category X comes to service pick connStrX. Here is shown how to to something like this
精彩评论