开发者

Reading web-service information from assembly app.config file

I have a plugin architecture solution written in .NET C# 3.5, where each plug-in is an assembly loaded by the main project.

Each plug-in can optionally consume web-service, so I would like to have the configuration of that plugin in its own plugin.dll.config file instead of having it in the app.config of the main project.

I have been looking around and I saw that i could load from each class its own config file:

// Get the application configuration file.
    System.Configuration.Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap,userLevel)

I see how that would help me get the basic settings from the appSettings section, but I cant see a way to read the web-service in开发者_Python百科formation stored in the plugin.dll.config file.

Any help on how to approach this situation is very welcome.


Here is a solution that overrides the ChanelFactory to use external configuration files.


Once you've loaded in the configuration from another location, you can use a ServiceModelSectionGroup.GetSectionGroup(config) call to retrieve the <system.serviceModel> group. Take a look at the ServiceModelSectionGroup's member documentation and pay special attention to properties like Client - I think it will get you the information you're looking for.

Good luck! Let me know if you need more details; I'll need a bit of sample configuration that you're wanting to use, etc.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜