
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.
Table of Contents
The remote name could not be resolved: ‘eastus.api.cognitive.microsoft.com’
Recently, while working with 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
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.TaskAwaiter
1.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

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

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
- How To Implement Azure Face API Using Visual Studio 2019
- Failed To Validate The Notification URL SharePoint Webhook Azure Function Endpoint
- How to Create And Consume Azure Function From ASP.NET Core
- CS1061 C# ‘HttpRequest’ does not contain a definition for ‘Content’ and no accessible extension method ‘Content’ accepting a first argument of type ‘HttpRequest’ could be found
- Python 400 client error: Bad request for URL Azure cognitive services
- The term ‘register-AzureProvider’ is not recognized as the name of a cmdlet
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’. Hope this will help you to fix your issue as well !!!