获取当前配置文件的文件名 [英] Get filename of current configuration file
问题描述
我认为这很简单,但我找不到答案。
I'd think this would be simple, but I can't find an answer.
我使用远程处理,我想将RemotingConfiguration存储在app.config。当我调用 RemotingConfiguration.Configure
时,我必须提供远程信息驻留的文件名。所以...我需要知道当前配置文件的名称。
I'm using remoting and I want to store the RemotingConfiguration in the app.config. When I call RemotingConfiguration.Configure
I have to supply the filename where the remoting information resides. So... I need to know the name of the current configuration file.
目前我使用的是:
System.Reflection.Assembly.GetExecutingAssembly().Location + ".config"
但是这只适用于windows应用程序,而不适用于web应用程序。
But this only works for windows applications, not for web applications.
没有任何类可以提供我的名称当前配置文件?
Isn't there any class that can supply me with the name of the current config file?
推荐答案
尝试 AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
http:// msdn .microsoft.com / en-us / library / system.appdomainsetup.configurationfile.aspx
这篇关于获取当前配置文件的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!