RestSharp: Error: Operation is not supported on this platform in ASP.NET Core 2.0 application

RestClient client;
client = new RestClient(Configuration.APIUrl);
            client.Authenticator = new HttpBasicAuthenticator(Configuration.Username, Configuration.Password);

RestRequest request = new RestRequest(Configuration.EndPoints.Clients, Method.GET);
            IRestResponse<ClientResult> response = client.Execute<ClientResult>(request);

            if (response.StatusCode != System.Net.HttpStatusCode.OK)
            {
                if (response.ErrorException != null)
                {
                    throw new Exception(response.ErrorMessage); // Error: Operation is not supported on this platform
                }
            }

Expected Behavior

Get the actual result in json, same call is working fine with HttpClient and in Postman

Actual Behavior

Error: Operation is not supported on this platform

Steps to Reproduce the Problem

Simple rest call setup

Specifications

ASP.NET Core 2.0 console application

StackTrace

``` at System.Net.SystemWebProxy.GetProxy(Uri destination) at System.Net.ServicePointManager.ProxyAddressIfNecessary(Uri& address, IWebProxy proxy) at System.Net.ServicePointManager.FindServicePoint(Uri address, IWebProxy proxy) at System.Net.HttpWebRequest.get_ServicePoint() at RestSharp.Http.ConfigureWebRequest(String method, Uri url) at RestSharp.Http.GetStyleMethodInternal(String method) at RestSharp.RestClient.Execute(IRestRequest request, String httpMethod, Func`3 getResponse) ```

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

I can verify that 106.0.0-alpha0284 solves the problem. However, it is still present in later builds; e.g. 106.2.0-alpha0060.