Server 2008 R2 SP1 issue

16 posts, 1 answers
  1. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 28 Feb 2011 Link to this post

    Hi,

    After applying SP1 for Server 2008 R2 (or SP1 for Windows 7), we started to receive errors when using RadCompression.

    The issue only occurs when calling web-services. The web-service call actually works but there is always an exception that is handled in Application_Error, and since we have centralized our error handling, an error is logged for each web-service call. Before SP1 there were no errors!!!

    The exception is:
    System.Web.HttpException (0x80004005): Server cannot append header after HTTP headers have been sent.
       at System.Web.HttpResponse.AppendHeader(String name, String value)
       at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    To reproduce the exception:
    Create new web application, add a page with the following code:
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication4.WebForm1" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
        <script runat="server">
            Sub rg_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rg.NeedDataSource
                Dim dt As New System.Data.DataTable()
                dt.Columns.Add("Col1", GetType(String))
                dt.Columns.Add("Col2", GetType(String))
                For i As Integer = 0 To 10
                    dt.Rows.Add({"Row" & i, "Data"})
                Next
                rg.DataSource = dt
            End Sub
        </script>
     
        <script type="text/javascript">
            function callWebService()
            {
                $telerik.$.ajax({
                    type: 'POST',
                    url: 'WebService1.asmx/HelloWorld',
                    contentType: 'application/json; charset=utf-8',
                    dataType: 'json'
                });
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager" runat="server">
        </asp:ScriptManager>
        <div>
            <telerik:RadGrid ID="rg" runat="server" AutoGenerateColumns="true" Width="100%">
                <ClientSettings>
                    <Scrolling AllowScroll="true" ScrollHeight="281px" UseStaticHeaders="true" />
                </ClientSettings>
            </telerik:RadGrid>
            <asp:Button ID="aaa" runat="server" Text="callWebService" OnClientClick="callWebService(); return false;" />
        </div>
        </form>
    </body>
    </html>

    Add a web-service with the following code-behind:
    Imports System.Web.Services
    Imports System.Web.Services.Protocols
    Imports System.ComponentModel
     
    <System.Web.Script.Services.ScriptService()>
    Public Class WebService1
        Inherits System.Web.Services.WebService
     
        <WebMethod()> _
        Public Function HelloWorld() As String
            Return "Hello World"
        End Function
     
    End Class


    web.config System.webServer section:
    <system.webServer>
            <modules runAllManagedModulesForAllRequests="true">
                <remove name="RadCompression" />
                <add name="RadCompression" preCondition="managedHandler" type="Telerik.Web.UI.RadCompression" />
            </modules>
        </system.webServer>

    Deploy the web application to an IIS web application!
    Important!!! it must run in a "real" IIS web application and not the Visual Studio built in web server.

    When pressing the button, an error on the server will always occur (even as the web service works!!!).
    You can see the exception when attaching to the IIS and setting a break-point in Global.asax.vb on the Application_Error line (or logging the error here).
     
    Regards
    Caesar
  2. Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 03 Mar 2011 Link to this post

    Hi Caesar,

    Can you please remove the runAllManagedModulesForAllRequests attribute from your web.config or set it to false and let us know if that has any impact on the behavior:
    Copy Code
    <modules runAllManagedModulesForAllRequests="false">

    Regards,
    Pavel
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 03 Mar 2011 Link to this post

    Hi,

    No difference, both removing the attribute and setting it to false still gives the exception.

    Regards
    Caesar
  5. Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 07 Mar 2011 Link to this post

    Hello Caesar,

    I tested the code you provided on a Windows 7 machine with installed Service Pack 1 and could not reproduce the described problem. The web service is called correctly and there are no errors in the IIS log file.

    Best wishes,
    Pavel
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  6. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 07 Mar 2011 Link to this post

    Hi,

    The problem isn't that there are errors logged automatically in the IIS log file. The exception is caught by Application_Error in Global.asax!
    We have made a centralized error handling that logs all errors in the Application_Error event, this is where the exception turns up after applying SP1:
    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when an error occurs
        DoSomeLogging()
    End Sub

    To reproduce the error you will have to do some kind of logging in this event, or run in debug and set a breakpoint in this event.
    The strange thing is that the webservice actually works and get called correctly. Our problem is that when logging all errors in this event, there will be thousands of errors in a day in our application, and this wasn't a problem before SP1. All our installed instances suffered from this the day after SP1 was applied.

    Important!!! It must run in a "real" IIS web application and not the Visual Studio built in web server.

    Regards
    Caesar
  7. Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 07 Mar 2011 Link to this post

    Hi Caesar,

    Thank you for the additional explanation. However I am still unable to replicate the behavior. I am attaching a test website which works as expected on my end. I hosted it on IIS 7.5 on Windows 7 machine with installed SP1, using a 4.0 application pool in Integrated mode. Please let me know what I may be missing.

    All the best,
    Pavel
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  8. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 07 Mar 2011 Link to this post

    Hi,

    How do you verify? Did you set a break point on the following line in Global.asax and attached debugger to the w3wp.exe process?:
    void Application_Error(object sender, EventArgs e)

    When breakpoint on that line on my side, for each webservice call I get to this line of code with the given exception in Server.GetLastError().

    Regards
    Caesar
  9. Answer
    Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 08 Mar 2011 Link to this post

    Hello Caesar,

    Thank you for the additional details. We were able to replicate the problem and can suggest you the following workaround. You can create your own module, which inherits from RadCompression and add the following to it:
    Copy Code
    Copy Code
    namespace MyNamespace
    {
        public class CustomModule1 : RadCompression
        {
            protected override bool ShouldExclude(string handlerPath)
            {
                if (String.Compare(HttpContext.Current.CurrentHandler.GetType().FullName, "System.Web.Handlers.TransferRequestHandler") == 0)
                    return true;
                return base.ShouldExclude(handlerPath);
            }
        }
    }

    Then you can register the module in web.config like this:
    Copy Code
    Copy Code
    <system.webServer>
            <modules >
                <add name="CustomModule1" type="MyNamespace.CustomModule1" preCondition="managedHandler"/>
            </modules>
        </system.webServer>

    I am attaching a sample test page for reference. Our developers will continue to investigate a possible solution within our module. I have also updated your Telerik points for your involvement.

    All the best,
    Pavel
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  10. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 08 Mar 2011 Link to this post

    Hi,

    Thanks!!!

    We are in the middle of two releases of our product, so I will wait and see if it gets fixed in 2011 Q1 release:) Otherwise I will go for your workaround!

    Regards
    Caesar
  11. Richard
    Richard avatar
    27 posts
    Member since:
    Sep 2008

    Posted 11 Mar 2011 Link to this post

    Hello,

    I can confirm that precisely this is also happening on our site since the installation of SP1. It has been driving me nuts. I was trying to localise it again when I found this thread. Caesar, how did you figure out it is the Telerik RadCompression code? This is what our messages look like:

    ERROR 2011-03-11 20:24:09,395 83.170.113.102 83.170.113.102 2011-03-10T02:26:53-796 [857] 85357443ms Global                 Application_Error                -  Last Chance Handler., ExType=System.Web.HttpException, InnerExType=none, Exception = System.Web.HttpException (0x80004005): Server cannot append header after HTTP headers have been sent.
       at System.Web.HttpResponse.AppendHeader(String name, String value)
       at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    Telerik Support: WILL YOU PLEASE CONFIRM that the fix will be supplied in the next release so we don 't have to go patching around. I can just ignore this exception in my Global.asax.cs until then.

    Thanks again!
    R
  12. Nick Smith
    Nick Smith avatar
    9 posts
    Member since:
    Jan 2009

    Posted 15 Mar 2011 Link to this post

    Yup,

    We are also experiencing this problem in the webservice that handles our radcomboboxes.  When trying to to access the httpcontext.Session object and Context.Cache object.

    This has begun after applying Server 2008 SP1

    Nick Smith
  13. Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 15 Mar 2011 Link to this post

    Hi guys,

    A fix for this will be available with the Q1 release, which will be launched this week.

    Kind regards,
    Pavel
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  14. Gal
    Gal avatar
    48 posts
    Member since:
    Apr 2009

    Posted 15 Mar 2011 Link to this post

    We are also experiencing this problem in the webservice any way of getting early releases temporary patches for the current controls ?
  15. Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 16 Mar 2011 Link to this post

    Hello Gal,

    As already explained, a fix will be available with the release which is scheduled for this week. As an alternative option you can use the workaround provided in one of my previous posts.

    Greetings,
    Pavel
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  16. allday
    allday avatar
    4 posts
    Member since:
    Feb 2008

    Posted 14 Sep 2011 Link to this post

    Has this issue been resolved?
  17. Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 14 Sep 2011 Link to this post

    Hello Allday,

    Yes, the problem is addressed in the module for the Q1 2011 release. Let us know if you are still experiencing the problem.

    All the best,
    Pavel
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017