Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Apache 2.2 Connection was forcibly closed by remote host |
|
Author |
|
dbnex14
Joined: 22 Jul 2015 Posts: 17 Location: Canada, Vancouver
|
Posted: Tue 08 Sep '15 3:22 Post subject: Apache 2.2 Connection was forcibly closed by remote host |
|
|
Hi,
I am using a .NET Compact Framework 3.5 client that talks to server (Apache 2.2 shared module) which talks to database.
My client will sometimes retrieve large amount of data in a server call. So, I am using AutomaticDecompression on client and I have enabled gzip, deflate on Apache. However, if I try to fetch large amount of data, I will get the error:
Code: | "An existing connection was forcibly closed by the remote host" |
I am not finding anything in apache logs showing this error, it is showing on my client app.
Here is my GetWebRequest() method on client:
Code: | protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest req = (HttpWebRequest)base.GetWebRequest(uri);
byte[] credentialBuffer = new UTF8Encoding().GetBytes(Settings.Get("usr") + ":" + Settings.Get("pwd"));
req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(credentialBuffer));
req.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
return req;
} |
I have also noticed on occasion "The operation has timed out" error.
Not sure this is question for Apache forums as I dont see the error in Apache logs but since it says that remote host forcibly closed it, I thought it might be Apache or some Apache settings.
Please help,
Much appreciated, |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 08 Sep '15 10:48 Post subject: |
|
|
it KeepAlive enabled in Apache?
Does the client send a KeepAlive Signal?
Firefox for example requesting Apache Lounge
Code: |
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: de,en-US;q=0.7,en;q=0.3
Cache-Control: max-age=0
Connection: keep-alive
Host: www.apachelounge.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
|
|
|
Back to top |
|
dbnex14
Joined: 22 Jul 2015 Posts: 17 Location: Canada, Vancouver
|
Posted: Tue 08 Sep '15 18:06 Post subject: |
|
|
Is KeepAlive enabled on Apache?
Yes, KeepAlive is ON, here is what I have in httpd.conf:
Code: | KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 60 |
and what I have in httpd-mpm.conf:
Code: | <IfModule mpm_winnt_module>
ThreadsPerChild 1000
MaxRequestsPerChild 0
Win32DisableAcceptEx
</IfModule> |
Does the client sends an KeepAlive signal?
It should, as KeepAlive is by default True and I haven't changed it in my override GetWebRequest() above. I also checked and it is set to True on my request.
Here is how my request and response look like, note that .NET AutomaticDecompression property sets/gets encoding for you, so there is no need to set Accept-Encoding but I did try setting it explicityly in my GetWebRequest() method by adding
Code: | req.Headers.Add("Accept-Encoding", "gzip, deflate"); |
Here is my request and response:
Admin note: Moved to http://apaste.info/4Yf |
|
Back to top |
|
|
|
|
|
|