0
嘿,你好,我是用MVC ATM正與一把umbraco,我試圖與Web客戶端的HTTP協議API調用。與Web客戶端的HTTP請求。隨機錯誤(驗證失敗,因爲對方已關閉傳輸流)。
這是我做的請求。
[HttpPost]
public JObject CheckAuth()
{
string URI = "https://nedfinity.api.accelo.com/oauth2/v0/token";
string myParameters = "grant_type=client_credentials&scope=read(all)";
var clientId = "this is a secret";
var clientSecret = "this is a secret";
var byteArray = new UTF8Encoding().GetBytes(clientId + ":" + clientSecret);
using (WebClient wc = new WebClient())
{
wc.UseDefaultCredentials = true;
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
wc.Headers[HttpRequestHeader.Authorization] = "Basic " + Convert.ToBase64String(byteArray);
string HtmlResult = wc.UploadString(URI, myParameters);
JObject json = JObject.Parse(HtmlResult);
return json;
}
}
它曾經工作得很好,但沒有出現在我編輯CSS時停止工作的地方。我試圖扭轉所有我在bitbucket中的提交,但沒有修復。 此外,當試圖從accelo調用api正常工作。 這個我從服務器獲取唯一的反饋:
data
:
Object
ExceptionMessage
:
"Verification failed because the other party has closed the transport stream."
ExceptionType
:
"System.IO.IOException"
Message
:
"An error has occurred."
StackTrace
:
" bij System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
↵ bij System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
↵ bij System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
↵ bij System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
↵ bij System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
↵ bij System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
↵ bij System.Net.TlsStream.CallProcessAuthentication(Object state)
↵ bij System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
↵ bij System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
↵ bij System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
↵ bij System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
↵ bij System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
↵ bij System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
↵ bij System.Net.ConnectStream.WriteHeaders(Boolean async)"
任何人都知道是什麼導致這個問題,以及如何解決,或在哪裏看?
我想我自己也有一些配置設置或網絡權限的事,但它是一個本地主機,我沒有改變在這個時候任何可能導致此問題。
P.S.我希望通過這種正確的方式提出一個問題,如果有什麼不對,請隨時指出我的看法。
嘿克雷格, 感謝您的響應。我馬上嘗試一下。 問候添 – Oldaran
嘿克雷格,這似乎工作:d。非常感謝您的幫助。最近這個變化了嗎? 問候,蒂姆 – Oldaran
附:另外我可以在哪裏找到這個變化?是Web客戶端庫還是http請求協議還是其他? – Oldaran