-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to test successfully #110
Comments
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. |
Any ideas why I could be seeing these errors in testing and translation? |
I don't have an idea at this point.
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. |
Chris,
Thanks for this I was not on a VPN or anything which should block the ability to get to the api but I will load this up in Visual Studio and do a little troubleshooting and get back with you on the resolution.
Matt
…________________________________
From: Chris Wendt ***@***.***>
Sent: Monday, March 6, 2023 11:49 PM
To: MicrosoftTranslator/DocumentTranslation ***@***.***>
Cc: Lippy1m1 ***@***.***>; Author ***@***.***>
Subject: Re: [MicrosoftTranslator/DocumentTranslation] Unable to test successfully (Issue #110)
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 test translation. 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.
—
Reply to this email directly, view it on GitHub<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftTranslator%2FDocumentTranslation%2Fissues%2F110%23issuecomment-1457525948&data=05%7C01%7C%7C68c7ea9cbd084c9a7db508db1ec76603%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638137613986040714%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=j9ryX0rwH5v76HcAm5DNvLJ7tCJT4bGxzJWdmpID36Y%3D&reserved=0>, or unsubscribe<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFKRDRH6SENIOCZ2YBY3DPLW2247HANCNFSM6AAAAAAVNQ65NQ&data=05%7C01%7C%7C68c7ea9cbd084c9a7db508db1ec76603%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638137613986040714%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=j4engRNTWf2MniCgAWXUOTUsnCmC4DlctvOgXg%2FgU3o%3D&reserved=0>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Every time I "Test" I receive the same result. Test failed Invalid Key, or key does not match region. I have tried two different regions with the same result. What am I doing wrong here?
The text was updated successfully, but these errors were encountered: