【问题标题】:Error adding service reference The server committed a protocol violation添加服务引用时出错 服务器违反了协议
【发布时间】:2011-04-01 00:58:39
【问题描述】:

将应用程序移至共享主机后,我无法将服务引用添加到过去在专用服务器上工作的 .asmx 和 WCF 服务。

添加WCF服务引用的错误是:

There was an error downloading 'address ... Service.svc'.
The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF
Metadata contains a reference that cannot be resolved: 'address ... Service.svc'.
The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF
The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF
If the service is defined in the current solution, try building the solution and adding the service reference again.

asmx 网络参考:

There was an error downloading 'address ... .asmx'.
The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF
There was an error downloading 'address ... .asmx/$metadata'.
The server committed a

有什么想法吗?

【问题讨论】:

    标签: asp.net wcf asmx


    【解决方案1】:

    调试此问题的一种方法(并确保它是导致问题的协议违规)是使用 Fiddler(Http Web 代理)并查看是否发生相同的错误。如果没有(即 Fiddler 为您处理了问题),那么您应该能够使用 UseUnsafeHeaderParsing 标志来修复它。

    如果您正在寻找以编程方式设置此值的方法,请参阅此处的示例:http://o2platform.wordpress.com/2010/10/20/dealing-with-the-server-committed-a-protocol-violation-sectionresponsestatusline/

    【讨论】:

      【解决方案2】:

      看起来好像当您上传文件时,某些东西(可能是您的 ftp 客户端)将所有行尾转换为 Unix 样式。再次尝试重新上传文件,确保没有文件转换发生。

      【讨论】:

      • 没有。 “Web 服务文件”的内容与浏览文件生成的输出无关。
      【解决方案3】:

      似乎某些网络设备或软件设置为将行尾转换为 Unix 样式。对主机的技术支持人员这么说,他们可能会立即说,“哦,所以你不想打开 Unix 模式”或类似的东西。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-01-29
        • 2013-01-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-10
        • 2012-07-25
        相关资源
        最近更新 更多