问题描述
我公开为 CCW (COM可调用包装),并加载到一个非托管的IIS应用程序(ATL服务器).NET组件。该组件安装并使用COM注册 regasm / codeBase的
。
I have a .NET component exposed as a CCW (Com Callable Wrapper) and being loaded into an unmanaged IIS application (ATL server). The assembly is installed and registered with COM using regasm /codebase
.
组件需要配置,如通常放入Web.config文件中的IIS应用程序。但我不想砸配置成要么w3pw.exe.config或machine.config中 - 在理想情况下,我想将配置现场的旁边安装暴露于COM大会
The component requires configuration such as is typically put into a Web.config file for an IIS app. But I don't want to drop the config into either w3pw.exe.config or machine.config - Ideally I'd like the configuration to be installed live along side the assembly that is exposed to COM.
我还没有找到一种方法来实现这一目标。由于COM组件加载到默认的AppDomain,所以我不认为我可以配置域从其他位置加载。
I haven't found a way to achieve this. Since the COM assembly is loaded into the default AppDomain, so I don't think I can configure that domain to load from an alternate location.
推荐答案
您可以尝试
AppDomain.CurrentDomain.SetData ("APP_CONFIG_FILE",ConfigFile);
在哪里ConfigFile实现是完整路径到应用程序的app.config文件(C:\测试\ myapp.config)。从的
这篇关于如何获得一个.NET CCW组件从dll.config加载配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!