0

我正在为窗口电话调用 asmx Web 服务。这是我的代码。当我执行此代码时,它给了我以下错误:

ArgumentException:无效的 appId 参数名称:appId:ID=3010.V2_Soap.Translate.3C775314

    private void button1_Click(object sender, RoutedEventArgs e)
    {
        ServiceReference1.LanguageServiceClient myclient = new ServiceReference1.LanguageServiceClient();

        myclient.TranslateAsync(AppIdString, textBox1.Text, "en", "fr", "text/plain", "general");

        myclient.TranslateCompleted += new EventHandler<ServiceReference1.TranslateCompletedEventArgs>(translatecompleted);

    }

    private void translatecompleted(object obj, ServiceReference1.TranslateCompletedEventArgs e)
    { 

        textBlock1.Text = e.Result.ToString();
    }
4

1 回答 1

0

我解决了我的问题。错误是我没有将servicesoapclient放入其中。这是正确的代码。

private void button1_Click(object sender, RoutedEventArgs e)
    {
        jomarzi.ServiceSoapClient obj = new jomarzi.ServiceSoapClient();
        obj.HelloWorldCompleted +=new EventHandler<jomarzi.HelloWorldCompletedEventArgs>(obj_HelloWorldCompleted);
        obj.HelloWorldAsync();



    }

    private void obj_HelloWorldCompleted(object sender, jomarzi.HelloWorldCompletedEventArgs e)
    {
        textBlock1.Text = e.Result;
    }
于 2013-04-24T11:00:59.310 回答