首页 新闻 赞助 找找看

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

0
悬赏园豆:5 [已关闭问题]

我为sharepoint创建了一个web part 的工程项目,然后填写代码如下:

namespace CustProperties
{
    [Guid("17dff240-3c84-4fa1-ac0f-cf872a72a5b7")]
    public class CustProperties : System.Web.UI.WebControls.WebParts.WebPart
    {
        public CustProperties()
        {
            this.ExportMode = WebPartExportMode.All;
        }

        protected override void Render(HtmlTextWriter writer)
        {
            writer.Write(this.StrText);
        }

        private string _strText = string.Empty;

        [Personalizable]
        [WebBrowsable]
        [WebDisplayName("请输入一段文字")]
        [WebDescription("web part 上将会出现这段文字")]
        [Category("个性设置")]
        public string StrText
        {
            get
            {
                return _strText;
            }
            set
            {
                _strText = value;
            }
        }

        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            // TODO: add custom rendering code here.
            // Label label = new Label();
            // label.Text = "Hello World";
            // this.Controls.Add(label);
        }
    }
}

然后编译项目通过,然后点击“部署解决方案”,出现错误提示如下:

The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF 

在网上搜索了一下解决方案,如下:

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

The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF

主体意思是微软没有容忍不符合RFC 822中的httpHeader必须以CRLF结束的规定的服务器响应。

一个解决方案是在application.configweb.config文件里加入

  <system.net>

    <settings>

      <httpWebRequest useUnsafeHeaderParsing="true" />

    </settings>

  </system.net>

允许系统容忍(tolerant)只以CRLF结尾的hearder信息

可是在这个web part工程中根本没有web.config之类的文件,我曾试着去更改c://windows/microsoft.net下边的配置文件,也曾在web part项目下手工创建app.config文件,可是都没有解决问题。

请问哪位高手可以帮我解决这个问题啊?谢谢了先

问题补充: error log: Error Error: System.ServiceModel.CommunicationException System.ServiceModel.CommunicationException: The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF ---> System.Net.WebException: The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) --- End of inner exception stack trace --- Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Microsoft.SharePoint.Tools.SPServiceReference.ISPService.GetWeb(String url) at Microsoft.SharePoint.Tools.SharePointSolutions.SolutionDeployer.Valid
shixiangzb007的主页 shixiangzb007 | 初学一级 | 园豆:195
提问于:2010-04-14 13:21
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册