1
下面是我的POST請求POST請求的內容類型 「應用程序/ x-WWW的形式,進行了urlencoded」 沒有在服務器工作(QA,UAT ...),但能正常工作本地
request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
request.Method = "POST";
request.ContentLength = data.Length;
if (timeoutOverride.HasValue)
{
timeout = timeoutOverride.Value;
}
else
{
timeout = GetTimeoutForUrl(request.RequestUri);
}
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
streamWriter.Write(data);
streamWriter.Flush();
streamWriter.Close();
}
var asyncResult = request.BeginGetResponse(null, null);
string responseData;
try
{
using (asyncResult.AsyncWaitHandle)
{
bool complete = asyncResult.AsyncWaitHandle.WaitOne(timeout);
if (!complete)
{
ThrowTimeoutError(url, timeout);
}
using (var webResponse = request.EndGetResponse(asyncResult))
{
using (var responseStream = webResponse.GetResponseStream())
{
using (var responseStreamReader = new StreamReader(responseStream))
{
responseData = responseStreamReader.ReadToEnd();
}
}
}
}
請幫助我出了,如何使它在服務器上工作,我認爲這是服務器配置問題。否則問題與我的請求,它在本地工作正常,而不是在服務器上工作。
嗨,感謝您的迴應。我剛剛添加了MIME類型「application/x-www-form-urlencoded」和擴展名類型爲「.CS」....但仍然無法正常工作,請確認其他更改..plz能幫助我嗎? – user1169594