Description of a hotfix that adds the SuppressPreamble property into the HttpResponseMessageProperty class in the .NET Framework 3.5 SP1

Article translations Article translations
Article ID: 979533 - View products that this article applies to.
Expand all | Collapse all

On This Page

Introduction

This hotfix adds the SuppressPreamble property into the HttpResponseMessageProperty class in the Microsoft .NET Framework 3.5 Service Pack 1 (SP1). The SuppressPreamble property is a Boolean property. When the property is set to true in the Windows Communication Foundation (WCF) service, certain properties of a HTTP response message can be set automatically. These properties include the Headers property, the ContentType property, and the StatusCode property. When you set these properties, the HttpTransport channel does not have to set these properties again. Therefore, when a WCF client accesses the WCF service, the service can send a status notification to the client by using the current HTTP response message.

Note The SuppressPreamble property works only when WCF services are running in ASP.NET compatibility mode.

MORE INFORMATION

Hotfix information

Windows Vista Service Pack 2 (SP2) or Windows Server 2008 SP2

To resolve this problem in Windows Vista SP2 or in Windows Server 2008 SP2, download and apply the hotfix that is described in Microsoft Knowledge Base article 9810001. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
981001 A hotfix rollup is available for Windows Communication Foundation in the .NET Framework 3.5 SP1 for Windows Vista SP2 and Windows Server 2008 SP2

Windows 7 or Windows Server 2008 R2

To resolve this problem in Windows 7 or in Windows Server 2008 R2, download and apply the hotfix that is described in the following Microsoft Knowledge Base article:
981002 A hotfix rollup is available for Windows Communication Foundation in the .NET Framework 3.5 SP1 for Windows 7 and Windows Server 2008 R2
The following sample code shows how to use the SuppressPreamble property:
public void GetData()
{
     HttpContext hc = HttpContext.Current;
     string str = @"<?xml version=""1.0"" encoding=""utf-8""?>";
     byte[] buffer = new byte[str.Length];
     buffer = ASCIIEncoding.UTF8.GetBytes(str);

     HttpResponseMessageProperty responseProperty = new HttpResponseMessageProperty();
     responseProperty.SuppressPreamble = true;
     OperationContext.Current.OutgoingMessageProperties[HttpResponseMessageProperty.Name] = responseProperty;

     hc.Response.StatusCode = 200;
     hc.Response.ContentType = "text/xml; charset=utf-8";
     hc.Response.ClearContent();
     hc.Response.OutputStream.Write(buffer, 0, buffer.Length);
     hc.Response.Flush();
}

Properties

Article ID: 979533 - Last Review: October 7, 2011 - Revision: 2.0
APPLIES TO
  • Microsoft .NET Framework 3.5 Service Pack 1
Keywords: 
kbexpertiseadvanced kbsurveynew kbqfe KB979533

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com