开发者

How to read web.config from Web service instead Web.config from Web app

The question is simple, I have a web app which calls a web service. Both have its own web.config.

The problem I'm experiencing is I want to read the web.config belonging to the web service, but when I do it on the web service code in reality the web.config being read is the web.config belonging to the web app. I think this is due to the application domain, I mean, because the web app is calling the web service. This is my code placed on web service: System.Configuration.ConfigurationManager.AppSettings["name_connectionString"].ToString()

It returns null because is reading the web.config from web app instead of web.config from web service.

Anybody knows how can I proceed?? I don't find any type of clue at the moment

Thanks

Edit: My solution stills resides inside Visual Studio. It is formed by: - Web site containing web references - Web service - class library which is called by the web service to read data from databases

Is it开发者_如何学C possible that as they reside under the same virtual directory/application (eg: Visual Studio) is always reading the web.config from web app?


If they live under the same virtual directory/application, they will always use the same file.


There could be only one web.config per application. So if you have a separate web.config for your service you might need to setup a web method which returns the desired values and call this web method from your application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜