Visual Studio 2008 built-in web server needs integrated pipeline mode for Adding Http Header
Using Visual Studio 2008 and built-in web server.
In a Web Handler .ashx file
public void ProcessRequest(HttpContext context) {
context.Response.ContentType = MimeType_text_xvcard;
context.Response.Headers.Add(HttpHeader_ContentLength, "2138");
when I try to add an HTTP header I get the exception:
This operation requires IIS integrated pipeline mode.
Description: An unhandled exception occurred during the execution of the current web request. Please review the开发者_StackOverflow stack trace for more information about the error and where it originated in the code.
Exception Details: System.PlatformNotSupportedException: This operation requires IIS integrated pipeline mode.
I can find information about this error on the Internet but need specific info about how to presumably enable Integrated Pipeline mode (through web.config?) to allow HTTP headers to be manipulated.
How do do I put the built-in web server into integrated pipeline mode? Note: Not using full-fledged IIS
Try replacing
context.Response.Headers.Add
with
context.Response.AddHeader
(courtesy of this site)
I believe you have to be running IIS7 (in Integrated Pipeline mode) to use Headers.Add
Right Click on your Web Project and Select "Use IIS Express..."
精彩评论