Im trying to figure out why my PostMan GET works fine, but when i do the same command through Visual Studio, i get an empty JSON.
RestSharp GET
[HttpGet]
public IEnumerable<string> Get()
{
var client = new RestClient("http://ignitemedia.atlassian.net/rest/api/2/");
var request = new RestRequest("project/", Method.GET);
IRestResponse response = client.Execute(request);
var content = response.Content; // raw content as string
return null;
}
POSTMan GET
http://ignitemedia.atlassian.net/rest/api/2/project
no Headers
它唯一缺少的是“https”中的“s”。
I ran into the same issue. For me, it was an issue getting the request past the proxy. Adding this to the config file solved the issue:
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy autoDetect="False" bypassonlocal="True" proxyaddress="proxy domain address" usesystemdefault="False" />
</defaultProxy>
SSl issue in some places Place the below code in the method
ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.