I want to create a Bing translator, but the appid I got is invalid

1k views Asked by At
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

The above is a link to create a Bing translator, I followed the exact same steps but my app never works. I have no idea why it says my AppID is invalid, I spent an hour to get this id. Do you guys know how and where I can get a correct ID for this app?

1

There are 1 answers

1
Microsoft Translator On

The (free) App ID mechanism has been deprecated several years ago.

To access the Microsoft Translator API (be it text or speech) you need to get an Azure subscription and use the key provided there. There is a free tier at 2M characters a month. If you need more than this it starts at a $10 per M characters.

To get started: https://www.microsoft.com/en-us/translator/getstarted.aspx