Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 服务器违反了协议。章节=负责人详细信息=CR后面必须跟LF_C#_.net_App Config_.net Framework Version - Fatal编程技术网

C# 服务器违反了协议。章节=负责人详细信息=CR后面必须跟LF

C# 服务器违反了协议。章节=负责人详细信息=CR后面必须跟LF,c#,.net,app-config,.net-framework-version,C#,.net,App Config,.net Framework Version,我的App.config文件 <?xml version="1.0"?> <configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup> <system.net> <settings> <httpWebRequest useUnsafeHead

我的App.config文件

<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
  <system.net>
    <settings>
      <httpWebRequest useUnsafeHeaderParsing="true" />
    </settings>
  </system.net>
</configuration>
因此,我继续删除并尝试下载
.pdf
文件

<?xml version="1.0"?>
<configuration>
  <system.net>
    <settings>
      <httpWebRequest useUnsafeHeaderParsing="true" />
    </settings>
  </system.net>
</configuration>

而且它起作用了。我的应用程序是使用.Net Framework 4构建的


我想了解的是,删除这条线有什么影响,或者可以用其他方式修复它

根据我的经验,移除线路不会“破坏”任何东西。这一行只是直接针对应用程序中的.NETFramework4.0


这是我去年12月在转换我的一些项目并从文件中清除一些“无用”代码时遇到的一个好的、冗长的代码项目文件

感谢您的确认,我将通过链接查看。您知道该行导致错误的原因吗?或者我必须使用不同的属性?您可以尝试使用此方法,这可能是因为内容类型标题中的\r\n原因。字符集应该是内容类型标题行的一部分。另外,如果绝对需要使用多行(在本例中不是),可以将空间移动到正确的位置:char*message=“HTTP/1.1 200确定\r\n内容类型:text/xml;\r\n charset=utf-8\r\n\r\n”如果同时删除它们,会发生什么?
<?xml version="1.0"?>
<configuration>
  <system.net>
    <settings>
      <httpWebRequest useUnsafeHeaderParsing="true" />
    </settings>
  </system.net>
</configuration>