问题描述
我的控制台程序将dll加载到其他appdomain.
该dll与Web服务通信,但它提供了一个例外:
在GetWebRequest()
不在独立exe中运行时必须指定exePath.
在System.ConfigurationManager.OpenExeConfigurationInternal(.....).
据我在网上阅读的内容,因为dll尝试读取.config文件,但是由于dll位于不同的appdomain中,因此它失败了.
因此,如何禁用dll尝试访问.config文件.我的项目没有任何.config文件,不需要它们.
谢谢.
安蒂
dll尝试执行Web服务功能时会给出异常.
代码示例:
My console program loads a dll to different appdomain.
That dll communicates with webservice but it gives a exception :
On GetWebRequest()
"exePath must be specified when not running inside stand alone exe.
at System.ConfigurationManager.OpenExeConfigurationInternal(.....)".
As far as I read on web its because dll tries to read .config file but as dll is in different appdomain it fails.
So how to disable dll trying to access to .config file. My project dont have any .config files and dont need them.
Thank you.
Antti
Exception is given when dll is trying execute webservice function.
Code example :
Server.WebService myWebService = new Server.WebService();
myWebService.Url = "http://blaaah/Service.svc";
myWebService.TestFunction(); // <--- exception is thrown.
推荐答案
这篇关于必须指定C#exePath错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!