using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Translator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnTranslate_Click(object sender, EventArgs e)
{
string strTranslatedText = null;
try
{
TranslatorService.LanguageServiceClient client = new TranslatorService.LanguageServiceClient();
client = new TranslatorService.LanguageServiceClient();
strTranslatedText = client.Translate("b86b637103504cd4bdd4e1388a56e039", txtTraslatedFrom.Text, "", "en");
txtTranslatedText.Text = strTranslatedText;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_LanguageService" />
<binding name="BasicHttpBinding_LanguageService1" />
<binding name="BasicHttpBinding_LanguageService2" />
</basicHttpBinding>
</bindings>
<client>
<endpoint name="BasicHttpBinding_LanguageService"
address="http://api.microsofttranslator.com/V1/soap.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_LanguageService"
contract="TranslatorService.LanguageService" />
</client>
</system.serviceModel>
</configuration>
http://www.dotnetcurry.com/ShowArticle.aspx?ID=357
以上是创建 Bing 翻译器的链接,我按照完全相同的步骤操作,但我的应用程序无法正常工作。我不知道为什么它说我的 AppID 无效,我花了一个小时才得到这个 id。你们知道我如何以及在哪里可以获得此应用程序的正确 ID 吗?