asp.net中的Microsoft Translator Api

时间:2013-11-12 14:29:11

标签: asp.net microsoft-translator

我开发了一个asp.net Web应用程序,它通过Microsoft Translator API将文本翻译成多种语言。

我还在我的项目中下载了TranslatorContainer.cs文件。选择语言后会出现以下异常:

An exception of type 'System.Data.Services.Client.DataServiceQueryException' occurred in System.Data.Services.Client.dll but was not handled in user code

以下是我的代码:

protected void DDLLanguage_SelectedIndexChanged(object sender, EventArgs e)
    {
        Uri TranslatorUri = new Uri("https://api.datamarket.azure.com/Bing/MicrosoftTranslator/v1/Translate", UriKind.Absolute);
        TranslatorContainer TC = new TranslatorContainer(TranslatorUri);
        string Key = " nQbC5yt6BtCCvXRXQIW11mR1gzkxi8n1K1cTl9b/uvM";
        TC.Credentials = new NetworkCredential(Key, Key);
        Translation TranslatedText = TC.Translate(TxtTranslate.Text, DDLLanguage.SelectedValue,"en").Single();
        LblTranslatedText.Text = TranslatedText.Text;
    }

我的活动查看器显示:

Windows cannot load classes registry file. DETAIL - The system cannot find the file specified.

0 个答案:

没有答案