首页 > 代码库 > 服务器提交了协议冲突. Section=ResponseHeader Detail=CR 后面必须是 LF

服务器提交了协议冲突. Section=ResponseHeader Detail=CR 后面必须是 LF

解决办法:

ToggleAllowUnsafeHeaderParsing(true);
public static bool ToggleAllowUnsafeHeaderParsing(bool enable)        {            Assembly assembly = Assembly.GetAssembly(typeof(SettingsSection));            if (assembly != null)            {                Type settingsSectionType = assembly.GetType("System.Net.Configuration.SettingsSectionInternal");                if (settingsSectionType != null)                {                                        object anInstance = settingsSectionType.InvokeMember("Section",                    BindingFlags.Static | BindingFlags.GetProperty | BindingFlags.NonPublic, null, null, new object[] { });                    if (anInstance != null)                    {                        FieldInfo aUseUnsafeHeaderParsing = settingsSectionType.GetField("useUnsafeHeaderParsing", BindingFlags.NonPublic | BindingFlags.Instance);                        if (aUseUnsafeHeaderParsing != null)                        {                            aUseUnsafeHeaderParsing.SetValue(anInstance, enable);                            return true;                        }                    }                }            }            return false;        }