Jack is Here, asp.net findings

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘internet information services’

FIX: You receive an exception error message when you specify a Content-Length HTTP header that is larger than 2 GB in ASP.NET 2.0

Symptoms
In Microsoft ASP.NET 2.0, when you try to use the TransmitFile function to specify a Content-Length HTTP header that is larger than 2 gigabytes (GB), you receive the following exception error message:

Value was either too large or too small for an Int32. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.OverflowException: Value was either too large or too small for an Int32. Additionally, you may experience a problem with application pool restarts under a heavy load. This problem can cause a decrease in performance on a server that is running Microsoft Internet Information Services (IIS) and an ASP.NET Web application.
Resolution
This problem occurs when ASP.NET 2.0 tries to parse the value of the Content-Length HTTP header as an Int32 data type. Therefore, if the value of the header is more than the maximum value of an Int32 data type, an overflow exception occurs. The maximum value of an Int32 data type is 2,147,483,647.

FIX: You may receive a ‘System.Runtime.InteropServices.COMException’ exception when you try to access a WPF application by browsing a Web service

Symptoms
Consider the following scenario. On a computer that has .NET Framework 3.5 Service Pack 1 (SP1) installed, you run an ASP.NET Web service application that is hosted on Internet Information Services (IIS). You use a Windows Presentation Foundation (WPF)-based application to generate content context for the Web Site or Web service, for example, images. In this scenario, when you try to access the WPF application by browsing the Web service, you may receive the following message:

A first chance exception of type ‘System.Runtime.InteropServices.COMException’ occurred in PresentationCore.dll
Additional information: The program issued a command but the command length is incorrect. (Exception from HRESULT: 0×80070018)
Resolution
When the WPF application calls the NtRequestWaitReplyPort function to dispatch a message through a local procedure call (LPC) to Windows Manager Session Manager service (UXSMS) in the DwmGetTransportAttributes function, the E_ACCESSDENIED exception is returned. Then, the DwmGetTransportAttributes function tries to decode the message. However, the message was never handled because it is not a valid packet. Therefore, the code returns E_INVALID_COMMAND_LENGTH and triggers the exception.