Visual Studio 2008 Embedded Web Server Requires Built-in Pipeline Mode to Add Http Header

Using Visual Studio 2008 and the embedded web server.

In the .ashx web handler 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 an exception:

This operation requires the integration of an IIS pipeline mode.

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 occurred in the code.

Exception Details: System.PlatformNotSupportedException: This operation requires IIS pipeline mode integration.

I can find information about this error on the Internet, but you need specific information on how to presumably enable Integrated Pipeline mode (via web.config?) In order to allow manipulation of HTTP headers.

How to install the embedded web server in integrated pipeline mode? Note: Do not use full IIS

+4
source share
2 answers

Try replacing

 context.Response.Headers.Add 

from

 context.Response.AddHeader 

(courtesy of this site )

I believe that you should run IIS7 (in Integrated Pipeline mode) to use Headers.Add

+4
source

Right-click on your web project and select "Use IIS Express ..."

+1
source

Source: https://habr.com/ru/post/1304916/


All Articles