当我试图从亲爱的系统获取销售列表时,我收到了500内部服务器错误的错误响应。 我有以下代码。
string xmlStringResult = string.Empty;
string url = _cred.StoreName + "/SaleList";
try
{
var req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "GET";
req.ContentType = "application/xml";
req.Headers.Add("api-auth-accountid", _cred.AccountId);
req.Headers.Add("api-auth-applicationkey", _cred.APIKey);
using (var resp = (HttpWebResponse)req.GetResponse())
{
if (resp.StatusCode != HttpStatusCode.OK)
{
string message = String.Format("Call failed. Received HTTP {0}", resp.StatusCode);
AppendLog(string.Format("Error: {0}", message));
return xmlStringResult;
}
var sr = new StreamReader(resp.GetResponseStream());
xmlStringResult = sr.ReadToEnd();
}
}
catch (Exception ex)
{
AppendLog(string.Format("Error: {0}", ex.Message));
}
return xmlStringResult;
请建议并谢谢。
答案 0 :(得分:0)
您是否可以控制亲爱的系统?