這是我如何調用使用.NET服務:爲什麼我會得到411長度要求的錯誤?
var requestedURL = "https://accounts.google.com/o/oauth2/token?code=" + code + "&client_id=" + client_id + "&client_secret=" + client_secret + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code";
HttpWebRequest authRequest = (HttpWebRequest)WebRequest.Create(requestedURL);
authRequest.ContentType = "application/x-www-form-urlencoded";
authRequest.Method = "POST";
WebResponse authResponseTwitter = authRequest.GetResponse();
但調用此方法時,我得到:
Exception Details: System.Net.WebException: The remote server returned an error: (411) Length Required.
我該怎麼辦?
你可以請參考我的問題「http://stackoverflow.com/questions/35308945/accessing-sftp-url-from-console-application-using-c-sharp」?我有類似的問題。我正在嘗試訪問SFTP URL –