Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# app.exe.config文件读取_C#_.net_Vb.net - Fatal编程技术网

C# app.exe.config文件读取

C# app.exe.config文件读取,c#,.net,vb.net,C#,.net,Vb.net,在调试web服务问题时(客户端是在c#下开发的windows桌面应用程序,它使用web服务),我遇到了以下情况。 PC上用于构建发布文件的Application.exe.config文件在启动时由应用程序读取,每当我将目录复制到另一台PC(部分PC而非全部PC)时,配置文件将不再被读取。 通过模拟下面的场景,我能够得出后一个结论。 下面列出了App.exe.Config文件: <?xml version="1.0" encoding="utf-8"?> <configurat

在调试web服务问题时(客户端是在c#下开发的windows桌面应用程序,它使用web服务),我遇到了以下情况。 PC上用于构建发布文件的Application.exe.config文件在启动时由应用程序读取,每当我将目录复制到另一台PC(部分PC而非全部PC)时,配置文件将不再被读取。 通过模拟下面的场景,我能够得出后一个结论。 下面列出了App.exe.Config文件:

 <?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="WebServiceSoap" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:6608/WS_POSsync.asmx" binding="basicHttpBinding"
                bindingConfiguration="WebServiceSoap" contract="ServiceReference1.WebServiceSoap"
                name="WebServiceSoap1" />
        </client>
    </system.serviceModel>
</configuration>

当我处理这个文件时(通过在开头添加一些单词,从而使XML不一致),应用程序会抛出一个异常,因此它似乎正在尝试获取该文件。 当我在另一台PC上部署相同的文件夹,并重复相同的场景时,可执行文件似乎正常运行


对此问题的任何澄清都将不胜感激。

此问题与任何配置问题无关,我发现客户端PC感染了特洛伊木马,该木马在复制文件时会更改原始文件名。通过终止特洛伊木马(Dibifu9)处理并粘贴文件后,问题就解决了。

您确定编辑了正确的文件吗?该文件将与可执行文件同名,但在结尾追加
.config
。例如:
MyApplication.exe
的app.config为
MyApplication.exe.config
,这是在e
MyApplication.exe
启动。当然,完全相同的文件。您正在部署哪个文件夹?是否可能您正在编辑bin/debug配置(例如),但正在运行bin/release可执行文件?否,我正在部署bin/release文件夹中的所有文件都是由生成操作生成的。