The remote name could not be resolved: ‘eastus.api.cognitive.microsoft.com’

The remote name could not be resolved azure

In this Azure tutorial, we will discuss how to fix the error The remote name could not be resolved: ‘eastus.api.cognitive.microsoft.com’. Which I got while creating an Intelligent C# Apps With Azure Cognitive Services.

The remote name could not be resolved: ‘eastus.api.cognitive.microsoft.com’

Recently, while working with the Azure Cognitive Services, I got the error The remote name could not be resolved: ‘eastus.api.cognitive.microsoft.com’.

As part of the requirement, I have created an Azure Cognitive Services Computer Vision API in the Azure Portal and then copied the Key and the endpoint URL value of the Azure Cognitive Services Computer Vision API. Then the requirement was to create a Windows application.

I have created a windows application using Visual Studio 2019 and added the required code. So main functionality was to upload an image on the windows form and then click on the Submit button and then the API will analyze the image and provide you a detailed description of different parameters.

The endpoint URL for my Azure Cognitive Services Computer Vision API was as below

https://eastus.api.cognitive.microsoft.com/vision/v3.0/analyze

You can check out the complete implementation along with the code on Build Intelligent C# Apps With Azure Cognitive Services to know what exactly I have done.

When I pressed F5 to run the Windows Application project, I got the error The remote name could not be resolved: ‘eastus.api.cognitive.microsoft.com’.

The complete error message was as below

System.Net.Http.HttpRequestException
HResult=0x80131500
Message=An error occurred while sending the request.
Source=mscorlib
StackTrace:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at MyInteligentApp.Form1.<MakeAnalaysisRequest>d__5.MoveNext() in C:\Users\Bijay\source\MyInteligentApp\MyInteligentApp\Form1.cs:line 67 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at MyInteligentApp.Form1.d__7.MoveNext() in C:\Users\Bijay\source\MyInteligentApp\MyInteligentApp\Form1.cs:line 90

This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
WebException: The remote name could not be resolved: ‘eastus.api.cognitive.microsoft.com’

The remote name could not be resolved: ‘eastus.api.cognitive.microsoft.com’ [Solved]

I have tried a couple of ways to fix this issue. But, there is one way that actually worked for me. Below is the change you need to do to fix this issue. You need to add the below lines of code in your App.config or Web.config file to fix this issue.

Open the App.config file and add the below lines of code

<system.net>
  <defaultProxy enabled="true" useDefaultCredentials="true">
  </defaultProxy>
</system.net>

Earlier, Before Adding the above code, the App.config file was looking like below

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
    </startup>
</configuration>

After adding the complete code, The App.config file will look like below

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
    </startup>
<system.net>
  <defaultProxy enabled="true" useDefaultCredentials="true">
  </defaultProxy>
</system.net>
</configuration>

You can see it here as below

The remote name could not be resolved: 'eastus.api.cognitive.microsoft.com'

Now after running the Windows application, I got the expected output without any issue. You can see it as below

How to fix the remote name could not be resolved

This is how I can able to fix the error The remote name could not be resolved while working with Azure Cognitive Services Computer Vision API.

You may also like following the Below Articles

Wrapping Up

Well, in this article, we discussed how to fix the error The remote name could not be resolved: ‘eastus.api.cognitive.microsoft.com’. This fix will also work for the below errors

  • The remote name could not be resolved
  • The remote name could not be resolved: ‘westus.api.cognitive.microsoft.com’
  • The remote name could not be resolved c#
  • The remote name could not be resolved azure
  • How to fix the remote name could not be resolved

Hope this will help you to fix your issue as well !!!

Leave a Comment