0

我开发了一个 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.
4

0 回答 0