简体   繁体   English

调用 SOAP WebService 时出现 FileNotFound 异常

[英]FileNotFound exception when calling a SOAP WebService

I developed a console application in C# that should call a Web Service method.我在 C# 中开发了一个控制台应用程序,它应该调用 Web 服务方法。

After I added the service reference and VS created the Proxy classes, I could use this to call the method:添加服务引用并 VS 创建代理类后,我可以使用它来调用该方法:

        var seed = new Seed.CrSeedClient();
        string semilla = await seed.getSeedAsync();

When getSeedAsync method is called, this is shown in the debug window and, of course, the method does not return what it should.当调用 getSeedAsync 方法时,这会在调试 window 中显示,当然,该方法不会返回它应该返回的内容。

'ConComm.exe' (CLR v4.0.30319: ConComm.exe): 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\mscorlib.resources\v4.0_4.0.0.0_es_b77a5c561934e089\mscorlib.resources.dll' loaded. Module was compiled with no symbols.
Thrown exception: 'System.IO.FileNotFoundException' in mscorlib.dll
Thrown exception: 'System.IO.FileNotFoundException' in mscorlib.dll
'ConComm.exe' (CLR v4.0.30319: ConComm.exe): 'C:\Users\jaime\AppData\Local\Temp\wcu5wg4c\wcu5wg4c.dll' loaded. Symbols loaded.

I have used steps explained here to try to solve the problem.我已使用此处说明的步骤来尝试解决问题。

First, I set首先,我设置

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

in app.manifest file to force the console application to run as administrator.在 app.manifest 文件中强制控制台应用程序以管理员身份运行。

Second, I added this in app.config file:其次,我在 app.config 文件中添加了这个:

  <system.diagnostics>         
    <switches>            
      <add name="XmlSerialization.Compilation" value="4"/>         
    </switches>    
  </system.diagnostics>

when I see C:\Users\jaime\AppData\Local\Temp\ folder, I can check that when that web service method is called, a folder is created with some files in it, so, it is not a permission issue.当我看到 C:\Users\jaime\AppData\Local\Temp\ 文件夹时,我可以检查当调用 web 服务方法时,创建了一个文件夹,其中包含一些文件,因此,这不是权限问题。

What else can I do as another attempt?作为另一次尝试,我还能做些什么?

By the way, when using SoapUI application, the method works well, so, it is not a problem of the WS.顺便说一句,在使用 SoapUI 应用程序时,该方法运行良好,因此,这不是 WS 的问题。

Regards Jaime问候詹姆

Maybe try putting a try catch around the method call to see if you could view the InnerException to get more information也许尝试在方法调用周围放置一个 try catch 以查看是否可以查看 InnerException 以获取更多信息

try
{
    var seed = new Seed.CrSeedClient();
    string semilla = await seed.getSeedAsync();
}
catch(Exception e)
{
    var details = e.InnerException;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM