Visual Studio 2008内置Web服务器需要集成管道模式来添加Http标头
使用 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 标头时,出现异常:
此操作需要集成 IIS 管道模式。
描述:未处理的异常 执行期间发生的 当前的网络请求。请查看 堆栈跟踪以获取有关的更多信息 错误及其起源 代码。
异常详细信息: System.PlatformNotSupportedException: 此操作需要集成IIS 管道模式。
我可以在 Internet 上找到有关此错误的信息,但需要有关如何启用集成管道模式(通过 web.config?)以允许操作 HTTP 标头的具体信息。
如何将内置Web服务器置于集成管道模式? 注意:不使用成熟的 IIS
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试替换
为
(由此网站提供)
我相信您必须运行 IIS7(在集成管道模式下)才能使用
Headers.Add
Try replacing
with
(courtesy of this site)
I believe you have to be running IIS7 (in Integrated Pipeline mode) to use
Headers.Add
右键单击您的 Web 项目并选择“使用 IIS Express...”
Right Click on your Web Project and Select "Use IIS Express..."