I build a service to call API from Python flask. This is my Service
public string CheckStatus(string json)
{
Utils log = new Utils();
string ResponseString = "";
HttpWebResponse response = null;
try
{
string schedulingAPIUrl = ConfigurationManager.AppSettings["SchedulingAPI_URL"];
var request = (HttpWebRequest)WebRequest.Create(string.Format(schedulingAPIUrl + "{0}", "CheckStatus"));
request.Accept = "application/json";
request.Method = "POST";
request.Timeout = Timeout.Infinite;
request.KeepAlive = true;
var myContent = json;
var data = Encoding.ASCII.GetBytes(myContent);
request.ContentType = "application/json";
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
response = (HttpWebResponse)request.GetResponse();
ResponseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
response = (HttpWebResponse)ex.Response;
ResponseString = "Some error occurred: " + response.StatusCode.ToString();
}
else
{
ResponseString = "Some error occurred: " + ex.Status.ToString();
}
}
return ResponseString;
}
My Service will transfer a parameter is a list of many dictionaries to my API. If the Parameter has an amount of ~ 10000 dictionaries, everything is ok. But If it has to amount to 1 million dictionaries or more, after my API run 8-10minutes, I get an error: "500 InternalServerError".
I use wfastcgi, IIS to deploy my API.
I don't know the reason for the 500 error being from my Service or my API.