开发者

Can AppDomainSetup.ConfigurationFile be loaded from database?

I'm working on a WCF host by using ServiceHost and dynamically creating several app开发者_Go百科lication domains to keep my services up. I'm also planning to keep my assemblies on database and load them by using Assembly.Load(byte[])

But now I stumbled on a problem: how to load my configuration file (aka *.dll.config) from database and pass it to my new domain? My prototype uses AppDomainSetup.ConfigurationFile and load it from file system, but it will not exist physically on disk.

There is any way to load that configuration file from a byte[]?


Are you storing application settings in that configuration file, or are you looking to customize the CLR's behavior e.g. using settings in the section?

I'm afraid that either way the ConfigurationManager and Configuration classes in the BCL use files exclusively. However, application settings are nothing more than XML-serialized objects, so you can easily roll your own configuration manager around them (I've done this on a couple of projects).

Finally, you can generate a temporary configuration file from your byte[], store it on disk, create the AppDomain off of it, and delete it when the AppDomain is gone.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜