gpt4 book ai didi

visual-studio-2008 - Visual Studio 2008 内置 web 服务器需要集成管道模式来添加 Http header

转载 作者:行者123 更新时间:2023-12-01 00:03:16 24 4
gpt4 key购买 nike

使用 Visual Studio 2008 和内置 Web 服务器。

在 Web 处理程序 .ashx 文件中

    public void ProcessRequest(HttpContext context) {

context.Response.ContentType = MimeType_text_xvcard;
context.Response.Headers.Add(HttpHeader_ContentLength, "2138");

当我尝试添加 HTTP header 时,出现异常:

This operation requires IIS integrated 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 originated in the code.

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



我可以在 Internet 上找到有关此错误的信息,但需要有关如何大概启用集成管道模式(通过 web.config?)以允许操纵 HTTP header 的具体信息。

如何将内置 Web 服务器置于集成管道模式?
注:不使用成熟的 IIS

最佳答案

尝试更换

context.Response.Headers.Add 


context.Response.AddHeader

(由 this site 提供)

我相信您必须运行 IIS7(在集成管道模式下)才能使用 Headers.Add

关于visual-studio-2008 - Visual Studio 2008 内置 web 服务器需要集成管道模式来添加 Http header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2502535/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com