The server provided an invalid message! Content-Length: 0

We have an old legacy web application, hosted in IIS, running on Windows 2019 server. For whatever unknown reason, when the user browses to the application URL, they get result:

The server provided an invalid message! Content-Length: 0

Tested using Chrome, Edge and IE, all the same. The “zero” content length is expected because this legacy web application is still using HTTP/0.9 protocol which doesn’t have HTTP header. The thing is that this is the only Windows 2019 server with this issue, all other Windows 2019 servers (other customers) work fine.

I made a PowerShell script that simulate HTTP server and output HTTP/0.9 (see below). Tested the script using IE by browsing to http://localhost:8085, and the issue was reproduced. So, the root-cause should not be IIS. And there is no web-proxy configured in the system.

So, I am wondering what the root-cause could be. I am suspecting some kind of Windows security policy blocking HTTP/0.9 protocol, but I have no idea which security policy. We tried disabling antivirus, same issue.

# HTTP/0.9 Server in PowerShell
$listener = [System.Net.Sockets.TcpListener]::new([System.Net.IPAddress]::Any, 8085)
$listener.Start()
Write-Host "Server running on port 8085..."

# Create a cancellation token source
$tokenSource = [System.Threading.CancellationTokenSource]::new()

# Function to handle Ctrl-C
function HandleCtrlC {
    Write-Host "Stopping server..."
    $tokenSource.Cancel()
    $listener.Stop()
    $listener.Server.Close()
    exit
}

# Register Ctrl-C handler
$null = Register-ObjectEvent -InputObject ([System.Management.Automation.PSObject] $Host) -EventName 'Exiting' -Action {
    HandleCtrlC
}

try {
    while (-not $tokenSource.Token.IsCancellationRequested) {
        # Check for pending client connections
        if ($listener.Pending()) {
            # Accept client connection
            $client = $listener.AcceptTcpClient()
            $stream = $client.GetStream()
            $reader = [System.IO.StreamReader]::new($stream)
            $writer = [System.IO.StreamWriter]::new($stream)

            # Read request (for HTTP/0.9, just read the first line)
            $requestLine = $reader.ReadLine()

            Write-Host "Received request: $requestLine"

            # Process request (for demo, always respond with Hello World + current date/time)
            if ($requestLine -like "GET *") {
                # Current date and time with milliseconds
                $currentTime = Get-Date -Format 'yyyy-MM-dd HH:mm:ss.fff'

                # HTTP/0.9 response (no headers, plain HTML content)
                $response = "<html><body><h1>Hello, World! Current Time: $currentTime</h1></body></html>"

                $writer.Write($response)
                $writer.Flush()  # Ensure the response is flushed
            }

            # Close the stream and the client connection
            $writer.Close()
            $reader.Close()
            $client.Close()
        }
        else {
            # Check for cancellation token
            if ($tokenSource.Token.IsCancellationRequested) {
                break
            }
            Start-Sleep -Milliseconds 100
        }
    }
}
finally {
    # Clean up resources
    $listener.Stop()
    $listener.Server.Close()
}

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật