Fix #801 and fix #802 to support IIS Classic mode