Windows Azure Web 角色 useUnsafeHeaderParsing="true" 无法正常工作,得到“服务器违反协议。Section=ResponseStatu

Posted

技术标签:

【中文标题】Windows Azure Web 角色 useUnsafeHeaderParsing="true" 无法正常工作,得到“服务器违反协议。Section=ResponseStatusLine”【英文标题】:Windows Azure web role useUnsafeHeaderParsing="true" not working getting "The server committed a protocol violation. Section=ResponseStatusLine" 【发布时间】:2016-05-25 07:21:35 【问题描述】:

我知道这篇文章可能看起来像重复,但我已经尝试了互联网和 *** 周围的所有解决方案方法,但我仍然不知道如何修复它。

我正在尝试从 Windows Azure 网络角色简单地进入其他一些 Linux-php 系统,我得到了 "服务器违反了协议。Section=ResponseStatusLine"

在我的本地机器上它可以工作,但在 Windows Azure 中的生产上它不是:-(。

我已经验证加载的程序集是正确的,框架版本是正确的。

我试图做的事情:

我已尝试将此添加到我的 web.config 中

<system.net>
 <settings>
   <httpWebRequest useUnsafeHeaderParsing ="true"/>
 </settings>

根本没用。

尝试添加这些:

request.ServicePoint.Expect100Continue = false;
request.KeepAlive = false;
ServicePointManager.Expect100Continue = false; 
ServicePointManager.MaxServicePointIdleTime = 99999; 

根本没用。

我曾尝试使用 http://restsharp.org/ 来执行请求根本不起作用。

我曾尝试使用 https://www.nuget.org/packages/Microsoft.Net.Http/ 来执行请求根本不起作用。

我曾尝试使用HttpClient Class 拨打电话

根本没用。

试过这个解决方案The server committed a protocol violation. Section=ResponseStatusLine in c# 根本没用。

尝试通过Reflection 设置属性useUnsafeHeaderParsing。 根本没用。

尝试了这么多东西超过 10 个小时没有结果.... 还是不行请帮忙。

【问题讨论】:

【参考方案1】:

Alter Digging and digging and try variant solution 我发现了问题!!!

问题是这台 Linux-PHP 机器前面有防火墙, 那是通过一条奇怪的 text-html 消息提供完全错误的响应。

所以问题是 .NET 返回一个不正确响应。

所以有效的步骤: 检查远程主机或 url 是否被防火墙阻止!

【讨论】:

以上是关于Windows Azure Web 角色 useUnsafeHeaderParsing="true" 无法正常工作,得到“服务器违反协议。Section=ResponseStatu的主要内容,如果未能解决你的问题,请参考以下文章

如何为 Windows Azure Web 角色上的 PHP 项目配置 TFS 构建定义以实现持续集成?

Windows Azure Web 角色 useUnsafeHeaderParsing="true" 无法正常工作,得到“服务器违反协议。Section=ResponseStatu

windows azure 自动缩放

使用 Windows Azure 的基于消息的体系结构

来自 Windows Azure 的请求被某个服务器阻止

Azure - 从辅助角色访问与 Web 角色相同的 blob