Giter Site home page Giter Site logo

Comments (6)

chriswendt1 avatar chriswendt1 commented on August 24, 2024

Hi Lippy, these three need to match and come from the same resource.
image

The Text Translation Endpoint should also match the endpoint as listed in the Azure resource.

Also verify:
Are you using the newest version of the app?
Is the translation job working, only the test is failing? What are you seeing when you run a translation?

from documenttranslation.

Lippy1m1 avatar Lippy1m1 commented on August 24, 2024

image

So yes, I am using the three values from the translator resource. I have tried two different regions and the same thing happens with the test. I am using the latest version 0.9.3.2 and when I try to do a text translation the app bombs and closes.

from documenttranslation.

Lippy1m1 avatar Lippy1m1 commented on August 24, 2024

The translator resource is S1 pay as you go. My OS is Windows 11 64bit and I do have .net core 6.0.14 installed as well.

from documenttranslation.

Lippy1m1 avatar Lippy1m1 commented on August 24, 2024

Any ideas why I could be seeing these errors in testing and translation?

from documenttranslation.

chriswendt1 avatar chriswendt1 commented on August 24, 2024

I don't have an idea at this point.
Here is the code that produces the error message you are seeing when you run "Test":

       private static async Task TryCredentialsKey(string subscriptionKey, string azureRegion, string TextTransUri)
        {
            if (string.IsNullOrEmpty(TextTransUri)) TextTransUri = "https://api.cognitive.microsofttranslator.com";
            using HttpRequestMessage request = new() { Method = HttpMethod.Post, RequestUri = new Uri(TextTransUri + "/detect?api-version=3.0") };
            request.Headers.Add("Ocp-Apim-Subscription-Key", subscriptionKey);
            if (azureRegion?.ToLowerInvariant() != "global") request.Headers.Add("Ocp-Apim-Subscription-Region", azureRegion);
            request.Content = new StringContent("[{ \"Text\": \"English\" }]", Encoding.UTF8, "application/json");
            HttpClient client = new();
            HttpResponseMessage response = await client.SendAsync(request);
            if (!response.IsSuccessStatusCode)
                throw new CredentialsException("Invalid key, or key does not match region.");
        }

It does a simple language detection. If all your credentials and URLs are correct, as you expect them to be, check if a firewall or proxy blocks your access to api.cognitive.microsofttranslator.com.

from documenttranslation.

Lippy1m1 avatar Lippy1m1 commented on August 24, 2024

from documenttranslation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.