我为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.config或web.config文件里加入
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>
允许系统容忍(tolerant)只以CR或LF结尾的hearder信息
可是在这个web part工程中根本没有web.config之类的文件,我曾试着去更改c://windows/microsoft.net下边的配置文件,也曾在web part项目下手工创建app.config文件,可是都没有解决问题。
请问哪位高手可以帮我解决这个问题啊?谢谢了先