添加服务引用时出错服务器提交了协议违规

时间:2010-08-19 09:58:10

标签: asp.net wcf asmx

将应用程序移动到共享主机后,我无法添加对曾经在专用服务器上工作的.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

有什么想法吗?

3 个答案:

答案 0 :(得分:2)

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

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

答案 1 :(得分:1)

看起来当你上传文件时(可能是你的ftp客户端)将所有行结尾转换为Unix风格。尝试重新上传文件,确保不会发生文件转换。

答案 2 :(得分:1)

看起来某些网络设备或软件设置为将行结尾转换为Unix风格。对托管人的技术支持人员说,他们可能会立即说:“哦,所以你不要打开Unix模式”或者其他类似的东西。