来自C#的Soap抛出InvalidOperationException

时间:2013-02-20 13:25:35

标签: c# soap invalidoperationexception

我正在使用此服务

https://api.4shared.com/jax3/DesktopApp?wsdl

文档:

http://www.4shared.com/developer/docs/samples/#

我添加了一个服务引用并像这样使用..

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using API4Shared.API_4Shared;

namespace API4Shared
{
    class Program
    {
        static void Main(string[] args)
        {
            DesktopAppJax2Client ApiClient = new DesktopAppJax2Client();
            Console.WriteLine("Trying to login");
            string str = ApiClient.login("dd", "d");
            Console.WriteLine("Response: " + str);
            Console.WriteLine("Ex End");
            Console.Read();
        }
    }
}

但它会像

那样抛出错误

InvalidOperationException未处理 反映'arg2'的错误。

这是我的配置

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="DesktopAppJax2PortBinding">
                    <security mode="Transport" />
                </binding>
                <binding name="DesktopAppJax2PortBinding1" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://api.4shared.com:443/jax3/DesktopApp"
                binding="basicHttpBinding" bindingConfiguration="DesktopAppJax2PortBinding"
                contract="API_4Shared.DesktopAppJax2" name="DesktopAppJax2Port" />
        </client>
    </system.serviceModel>
</configuration>

如何解决此问题?

0 个答案:

没有答案