try
{
var httpWebRequest = (HttpWebRequest)WebRequest.Create(argument);
httpWebRequest.ContentType = "text/json";
httpWebRequest.Method = "POST";
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
using (StreamWriter sw = File.AppendText(path_apilog))
{
sw.WriteLine("State :" + state);
sw.WriteLine("Output :" + result);
}
}
}
catch (Exception ex)
{
using (StreamWriter sw = File.AppendText(path_apilog))
{
sw.WriteLine("Exception Occurred :" + ex.ToString());
}
}
当我运行时,这段代码出了什么问题会给出错误 -
远程服务器返回错误:(500)内部服务器错误。
如何解决此错误?
答案 0 :(得分:0)
在web.config文件中,找到行<compilation targetFramework="4.5">
并插入调试属性并将其设置为true,例如:<compilation targetFramework="4.5" debug="true">
。