的SharePoint的web.config變化我已經寫了需要改變的web.config使用SPWebConfigModification
我有一個應該使所有這些配置功能SharePoint應用程序。該功能的代碼是這樣的:
SPSite site = properties.Feature.Parent as SPSite;
List<SPWebConfigModification> modifications = new List<SPWebConfigModification>();
modifications.AddRange(CustomErrorsModeConfig.Modifications);
webConfigModificationHelper.AddWebConfigModifications(site.WebApplication, modifications);
CustomErrorsModeConfig.Modifications屬性包含此代碼:
public static SPWebConfigModification[] Modifications = {
new SPWebConfigModification()
{
Owner = WebConfigModificationOwner,
Name = "mode",
Type = SPWebConfigModification.SPWebConfigModificationType.EnsureAttribute,
Path = "system.web/customErrors",
Sequence = 0,
Value = "Off"
}
};
然後最後webConfigModificationHelper.AddWebConfigModifications方法:
foreach (SPWebConfigModification modification in modifications)
{
webApp.WebConfigModifications.Add(modification);
}
webApp.Farm.Services.GetValue<SPWebService>().ApplyWebConfigModifications();
webApp.Update();
的問題是,我不斷收到這個錯誤:
Name cannot begin with the ''' character, hexadecimal value 0x27. Line 1, position 1453
在嘗試應用我的更改之前,這可能是web.config的問題嗎?
SPWebConfigModification屬性可能被錯誤地定義了嗎?
我的代碼中是否存在導致此錯誤的一些故障?
可能有一些我遺失的財產(例如web.AllowUnsafeUpdates)?
某些SharePoint站點配置?
我一直在試圖解決這個問題有一段時間了,沒有運氣:(任何想法?