Archive for category Windows Server
Apache server 2.4.6 hangs after serving requests from Internet Explorer 10/11
Posted by allenkwc in Apache, Linux, Technology, Windows Server on May 23, 2014
Apache server 2.4.6 hangs after serving requests from Internet Explorer 10/11
Symptoms:
Apache 2.4 running on Windows hangs when Internet Explorer 10/11 is used to acces pages on it.
Reproduction:
I had a very reproducible scenario: Only the first request to Apache coming from IE would work, all other subsequent requests would hang, in all browsers. As long as I did not use Internet Explorer there did not seem to be a problem, but once that was used everything would hang until Apache was restarted. Strangely enough after I had applied the fix (see below) I reverted it to do some more testing but was not able to reproduce the problem anymore…
Migitating factors:
I am not sure of these, just describing the setup I was using when I encountered these problems. If you know more, please leave a comment.
- Running on Windows 7
- Using Apache 2.4.6
- VMWare network drivers installed (see explanation for why this might be relevant)
- Using an experimental 64-bit build of PHP 5.5: php-5.5.5-Win32-VC11-x64
- Using Internet Explorer 11
- Using Twitter Bootstrap, MySQL
Cause:
It seems that I was being hit by an issue with Apache’s Multi-Processing Module optimized for Windows NT. See references below for some sources that describe this problem and the fix.
Fix:
Add this configuration snippet to Apache24/conf/httpd.conf
(bottom of file seems fine):
# Apparently this fixes an issue with Apache 2.4.6 on Windows hanging
# when serving requests from Internet Explorer 10/11.
AcceptFilter http none
AcceptFilter https none
Explanation:
From the Apache docs about AcceptFilter
:
This directive enables operating system specific optimizations for a listening socket by the Protocol type.
…
On Windows,none
uses accept() rather than AcceptEx() and will not recycle sockets between connections. This is useful for network adapters with broken driver support, as well as some virtual network providers such as vpn drivers, or spam, virus or spyware filters.
Copied from site: http://stijndewitt.wordpress.com/2014/01/10/apache-hangs-ie11/
Upgrading AppServ / Moving out from AppServ
Posted by allenkwc in Technology, Windows Server on May 22, 2014
AppServ hasn’t been updated since year 2008. The packages are actually outdated.
Below are the tips and tricks for setting up php and apache from sketch in order to switch from plain old app serv to update-to-date apache and php.
1. 32 bits or 64 bits?
this must be decided first before downloading the packages, which apache and php must be aligned, i.e. same platform must be selected for both php and apache, either 32bits or 64bits
2. php thread safe?
must download the thread safe version for apache. non-thread safe is just for IIS…
I downloaded below packages from the web
php-5.5.12-Win32-VC11-x64.zip
httpd-2.4.9-win64-VC11.zip
3. Unzip all those files into certain folder, i used the same “c:\AppServ” with different folder name as AppServ used to prevent conflicts first.
i.e. c:\AppServ\
– apache24
– php55
– mysql (didn’t upgrade yet… it’s more complicated when upgrading DB…)
4. Setup Apache configuration, note the changes in config setting from apache web site
http://httpd.apache.org/docs/trunk/upgrading.html
5. Link apache to php
LoadModule php5_module “C:/AppServ/php55/php5apache2_4.dll”
AddHandler application/x-httpd-php .php
PHPIniDir ‘C:\AppServ\php55\php.ini’
*Remember the PHPIniDir must be in normal slash and single quote ‘ *
6. Setup extension for php to MySQL
extension_dir = “C:\AppServ\php55\ext\”
* use full path!!! *
php still refer to c:\windows\ as the root path even apache pointing to the correct ini file. phpinfo() can help!
7. Performance Turning
in php.ini, i set output_buffering = Off . Seems it’s even faster, don’t know why…
added below config to httpd.conf as well for performance reasons…
HostnameLookups Off
SendBufferSize 1048576
8. Special Setup for Windows
Apache 2.4 hangs randomly while the httpd.exe is running.
The solution is to add the following to your httpd.conf
:
AcceptFilter http none
AcceptFilter https none
On Windows, this has the effect of disabling the AcceptEx() API (part of WinSock), which offers some performance improvements, but probably conflicts with Comodo Firewall.
Putting Comodo Firewall in “Disabled” mode doesn’t help because requests probably still go through Comodo’s networking code. I think Comodo would have to be uninstalled completely to eliminate the problem (though I haven’t tried it).
If you have a similar problem with Apache 2.2, you should use the Win32DisableAcceptEx directive instead.
Explanation:
From the Apache docs about AcceptFilter:
This directive enables operating system specific optimizations for a listening socket by the Protocol type.
…
On Windows, none uses accept() rather than AcceptEx() and will not recycle sockets between connections. This is useful for network adapters with broken driver support, as well as some virtual network providers such as vpn drivers, or spam, virus or spyware filters.
Find the latest file using Windows batch script
Posted by allenkwc in Technology, Windows Server on May 15, 2013
FOR /F "delims=|" %%I IN ('DIR "*.*" /B /O:D') DO SET NewestFile=%%I
Prompt for Input in Windows batch script
Posted by allenkwc in Technology, Windows Server on May 15, 2013
@echo off
set /p id="Enter ID: " %=%
Log Ping Time and TTL using PowerShell
Posted by allenkwc in Technology, Windows Server on October 3, 2012
1. In PowerShell, enable remote signed Set-ExecutionPolicy RemoteSigned 2. Create following powershell script to log down the result
$ping = new-object System.Net.NetworkInformation.Ping $WriteLog = "ServerMonitorLog.csv" $servers = "www.google.com","www.carters.com","hk.yahoo.com" $FileExists = (Test-Path $WriteLog -PathType Leaf) #If No Log File Exists, generate header if(!($FileExists)) { Add-Content $WriteLog "Date,Time,Server,IPAddress,Time,TTL" } Foreach($s in $servers) { $reply = $ping.send($s) $now = Get-Date if ($reply.status -eq "Success"){ $result=[string]::Format("{0},{1},{2},{3},{4},{5}",$now.ToShortDateString(),$now.ToShortTimeString(),$s, $reply.Address.ToString(),$reply.RoundtripTime,$reply.Options.Ttl) }else{ $z = [system.net.dns]::gethostaddresses($hostname)[0].ipaddresstostring $result=[string]::Format("FAIL,{0},{1}",$z,"***") } Add-Content $WriteLog $result }
如何利用 IIS7 的 ARR 模組實做 Reverse Proxy 機制
Posted by allenkwc in Windows Server on November 8, 2011
轉自 http://blog.miniasp.com/post/2009/04/13/Using-ARR-to-implement-Reverse-Proxy.aspx
Remote Desktop Connection behind a router (Multiple computers)
Posted by allenkwc in Windows Server on April 5, 2011
Change the RDP port by following procedures,
1. changing the registry key in
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber
2. that’s all!
Using iMacro for Performance Testing
Posted by allenkwc in .net, SharePoint, Windows Server on March 29, 2011
http://wiki.imacros.net/Sample_Code
Stopwatch is useful for counting the duration of the steps.
WerFault.exe Causing 100% CPU Loading
Posted by allenkwc in Windows Server on March 10, 2011
To disable the Windows Error Reporting Service (WerSvc) using control
panel:
1. Open control panel.
2. Select “System & Maintenance”
3. Select “Administrative Tools”
4. Select “Services”
5. Right-Click “Windows Error Reporting Service”
6. Select “Properties”
7. In the “Service Status” Section Click [Stop]
8. Set “Startup type:” to “Manual” or if this is started by another
application select “Disabled”
9. Save and close the dialog boxes.
CPU utilisation returned to normal immediately.
Implementing Role-Based Security for Site Map in asp.net
Posted by allenkwc in Windows Server on February 17, 2011
1. While the XSD for .sitemap files (from which the IntelliSense is derived) includes “securityTrimmingEnabled” attribute, it’s incorrect. It’s the result of an old VS 2005 bug that’s still around. That value should be set in web.config; we’ll take care of that next.
2. Define the siteMap in web.config, and add securityTrimmingEnabled=”true” as below,
<siteMap enabled="true"> <providers> <clear/> <add siteMapFile="Web.sitemap" name="AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider" securityTrimmingEnabled="true"/> </providers> </siteMap>