I am using the payment gateway API in my ASP.Net application. When tested in MonoDevelop with XSP, the application works. When I configure it to run in apache2 with mod_mono, the code continues to fail with a timeout error.
I am focused on what can be changed using hosting in Apache instead of XSP. In any case, below is the code that is disabled:
private string SubmitXml(string InputXml)
{
HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(_WebServiceUrl);
webReq.Method = "POST";
byte[] reqBytes;
reqBytes = System.Text.Encoding.UTF8.GetBytes(InputXml);
webReq.ContentType = "application/x-www-form-urlencoded";
webReq.ContentLength = reqBytes.Length;
webReq.Timeout = 5000;
Stream requestStream = webReq.GetRequestStream();
requestStream.Write(reqBytes, 0, reqBytes.Length);
requestStream.Close();
HttpWebResponse webResponse = (HttpWebResponse)webReq.GetResponse();
using (StreamReader sr = new StreamReader(webResponse.GetResponseStream(), System.Text.Encoding.ASCII))
{
return sr.ReadToEnd();
}
}
Line code failure: Stream requestStream = webReq.GetRequestStream();
Error returned:
Request Timeout
Description: HTTP 500. Request for error handling.
Stack trace:
System.Net.WebException: System.Net.HttpWebRequest.GetRequestStream() [0x0005f] /private/tmp/monobuild/build/BUILD/mono -2.10.9/mcs/class/System/System.Net/HttpWebRequest.cs:746 TCShared.PxPay.SubmitXml(System.String InputXml) [0x00048] /Users/liam/Projects/techcertain/techcertaincsharp/Components/TCShared/PaymentGateways/Client/PxPay.cs:85 TCShared.PxPay.GenerateRequest( TCShared.RequestInput) [0x00015] /Users/liam/Projects/techcertain/techcertaincsharp/Components/TCShared/PaymentGateways/Client/PxPay.cs:69
Web.Config - :
<httpRuntime executionTimeout="43200" maxRequestLength="104856" requestValidationMode="2.0" />
- HttpWebRequest, - .
?