|
MSDN上寫的不是很明白,自己測(cè)試通過(guò),記錄一下:
方法一:通過(guò)創(chuàng)建描述一組 Web.config 修改的 XML 文件以聲明方式注冊(cè) Web.config 項(xiàng)。
備注:
直接寫一個(gè)webconfig.**.xml到14文件夾下的CONFIG中,在運(yùn)行stsadm -o copyappbincontent 效果是一樣的;
方法一有個(gè)缺點(diǎn),會(huì)把所有WebApplication的web.Config都修改掉;
1.在sharepoint解決方案里添加14文件夾下的CONFIG文件夾,新建webconfig.**.xml文件(本文中使用的是webconfig.rj.xml),編輯內(nèi)容;
2.修改解決方案包,如下;
3.添加后期部署命令行,如果解決方案里沒(méi)有這一步,也可以直接在cmd中直接運(yùn)行;
"C:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/14/Bin/stsadm.exe" -o copyappbincontent
方法二:使用 SharePoint Foundation 對(duì)象模型來(lái)修改 Web.config 設(shè)置
備注:
2011-01-06:不能在site scope feature使用的原因找到了,是因?yàn)椤 PWebService.RemoteAdministratorAccessDenied默認(rèn)為TRUE,將下表中的腳本保存為Set-RemoteAdministratorAccessDenied-False.ps,以管理員身份運(yùn)行后IISreset,就OK了;
參考:http://unclepaul84.blogspot.com/2010/06/sppersistedobject-xxxxxxxxxxx-could-not.html (過(guò)墻)
# AUTHOR: Paul Kotlyar
# CONTACT: unclepaul84@gmail.com
# DESCRIPTION: sets an option on content web service that allows updating of SP Administration objects such as SPJobDefinition from content web applications
function Set-RemoteAdministratorAccessDenied-False()
{
# load sharepoint api libs
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration") > $null
# get content web service
$contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
# turn off remote administration security
$contentService.RemoteAdministratorAccessDenied = $false
# update the web service
$contentService.Update()
}
Set-RemoteAdministratorAccessDenied-False
NET技術(shù):更改SharePoint 的web.config設(shè)置的兩種方式,轉(zhuǎn)載需保留來(lái)源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。