title: System.Net.Http.HttpRequestException: Device not configured ---> System.Net.Sockets.SocketException: Device not configured
body: <blockquote>
    <p>System.Net.Http.HttpRequestException: Device not configured ---> System.Net.Sockets.SocketException: Device not configured</p>
  </blockquote>
  
  <p>I'm receiving the above error when trying to make a web request from a custom middleware piece for an aspnet core web application. The error occurs on the fourth line of the following block of code:</p>
  
  <pre><code>var web = new WebClient();
  var testing = _configuration.GetSection("IPStack")["AccessKey"];
  web.QueryString.Add("access_key", _configuration.GetSection("IPStack")["AccessKey"]);
  string ipstackRaw = web.DownloadString($"http://api.ipstack/{ipaddress}");
  </code></pre>
  
  <p>I'm using Visual Studio on Mac, Community Edition. What's causing this error?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I've tried a few things since the original post without success. Here is what I have tried:</p>
  
  <ul>
  <li>Running the application in Visual Studio, Professional Edition on my PC (Windows 10)</li>
  <li>Trying the request using <a href="https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=netframework-4.7.2" rel="noreferrer">HttpClient</a></li>
  <li>Trying the request outside the middleware</li>
  </ul>