SharePoint 解决方案包部署随机失败
在解决方案部署和/或功能激活期间,我不断看到此错误...
复制此文件失败。 此操作使用无法联系的 SharePoint 管理服务 (spadmin)。 如果该服务已停止或禁用,请将其启动并重试该操作。
以下是用于部署的 PowerShell 脚本:
$programfiles_path = $null
$stsadm_path = $null
$url = $null
$solution = $null
$feature = $null
$appPoolName = $null
$url = "http://" + ${env:COMPUTERNAME}
$programfiles_path = ${env:ProgramW6432}
if ($programfiles_path -eq $null)
{
$programfiles_path = ${env:ProgramFiles}
}
$stsadm_path = $programfiles_path + "\common files\microsoft shared\web server extensions\12\bin\stsadm.exe"
if(!(test-path $stsadm_path))
{
echo "stsadm.exe was not found: $stsadm_path"
exit -1
}
ECHO "***********************************"
ECHO "*** Contoso.Common.SolutionPackage ***"
ECHO "***********************************"
$solution = "Contoso.Common.SolutionPackage.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.Common.Infrastructure"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.CustomCAS"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.Common.WebParts"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.ExcelExtender"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*********************************"
ECHO "*** Contoso.Something ***"
ECHO "*********************************"
$solution = "Contoso.Something.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.Something"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*********************************"
ECHO "*** Contoso.Nothing ***"
ECHO "*********************************"
$solution = "Contoso.Nothing.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = $null
ECHO "*****************************************"
ECHO "*** Contoso.Everything ***"
ECHO "*****************************************"
$solution = "Contoso.Everything.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.Everything"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*****************************"
ECHO "*** Contoso.CashMoneyMillionaires ***"
ECHO "*****************************"
$solution = "Contoso.CashMoneyMillionaires.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.CashMoneyMillionaires"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "************************************"
ECHO "*** Contoso.DollaDollaBill ***"
ECHO "************************************"
$solution = "Contoso.DollaDollaBill.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.DollaDollaBill"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "************************"
ECHO "*** IIS APPPOOL MGMT ***"
ECHO "************************"
ECHO "*** query wmi for apppool ***"
$appPoolName = "SharedServices1"
$appPool = get-wmiobject -namespace "root\MicrosoftIISv2" -class "IIsApplicationPool" | Where-Object {$_.Name -eq "W3SVC/APPPOOLS/$appPoolName"}
if ($? -eq $false) { exit }
ECHO "*** recycle apppool ***"
$appPool.Recycle()
if ($? -eq $false) { exit }
我有一个等效的批处理文件,它也随机失败。 它在不同的服务器上失败。 我对原因和解决方案感到非常困惑。
任何帮助,将不胜感激。
I keep seeing this error sporadically during solution deployment and/or feature activation...
Copying of this file failed .
This operation uses the SharePoint Administration service (spadmin), which could not be contacted. If the service is stopped or disabled, start it and try the operation again.
The following is the PowerShell script used to deploy:
$programfiles_path = $null
$stsadm_path = $null
$url = $null
$solution = $null
$feature = $null
$appPoolName = $null
$url = "http://" + ${env:COMPUTERNAME}
$programfiles_path = ${env:ProgramW6432}
if ($programfiles_path -eq $null)
{
$programfiles_path = ${env:ProgramFiles}
}
$stsadm_path = $programfiles_path + "\common files\microsoft shared\web server extensions\12\bin\stsadm.exe"
if(!(test-path $stsadm_path))
{
echo "stsadm.exe was not found: $stsadm_path"
exit -1
}
ECHO "***********************************"
ECHO "*** Contoso.Common.SolutionPackage ***"
ECHO "***********************************"
$solution = "Contoso.Common.SolutionPackage.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.Common.Infrastructure"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.CustomCAS"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.Common.WebParts"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.ExcelExtender"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*********************************"
ECHO "*** Contoso.Something ***"
ECHO "*********************************"
$solution = "Contoso.Something.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.Something"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*********************************"
ECHO "*** Contoso.Nothing ***"
ECHO "*********************************"
$solution = "Contoso.Nothing.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = $null
ECHO "*****************************************"
ECHO "*** Contoso.Everything ***"
ECHO "*****************************************"
$solution = "Contoso.Everything.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.Everything"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*****************************"
ECHO "*** Contoso.CashMoneyMillionaires ***"
ECHO "*****************************"
$solution = "Contoso.CashMoneyMillionaires.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.CashMoneyMillionaires"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "************************************"
ECHO "*** Contoso.DollaDollaBill ***"
ECHO "************************************"
$solution = "Contoso.DollaDollaBill.wsp"
ECHO "*** add the solution ***"
& $stsadm_path -o addsolution -filename $solution
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "*** deploy the solution ***"
& $stsadm_path -o deploysolution -name $solution -immediate -allowgacdeployment -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
$feature = "Contoso.DollaDollaBill"
ECHO "*** activate feature(s) ***"
& $stsadm_path -o activatefeature -name $feature -url $url -force
if ($? -eq $false) { exit }
ECHO "*** execute admin jobs ***"
& $stsadm_path -o execadmsvcjobs
if ($? -eq $false) { exit }
ECHO "************************"
ECHO "*** IIS APPPOOL MGMT ***"
ECHO "************************"
ECHO "*** query wmi for apppool ***"
$appPoolName = "SharedServices1"
$appPool = get-wmiobject -namespace "root\MicrosoftIISv2" -class "IIsApplicationPool" | Where-Object {$_.Name -eq "W3SVC/APPPOOLS/$appPoolName"}
if ($? -eq $false) { exit }
ECHO "*** recycle apppool ***"
$appPool.Recycle()
if ($? -eq $false) { exit }
I have an equivalent batch file which also randomly fails. It fails on different servers. I am quite baffled as to the cause and solution.
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我发现做的最好的事情是有一个 Power Shell,它会等待待处理的计时器作业完成,然后再继续下一个任务,您可以暂停,但这需要您检查以确保时间作业完成了。
诀窍是使用 stsadm -o Displaysolution -name 轮询服务器。 如果服务器场上安装了 wsp,则该命令会返回一些 xml,如果有用于部署的计时器作业,则 xml 中会有一个“SolutionDeploymentJob”标记。 通过一个简单的循环,您可以等待时间作业完成
使用:
WaitForJobOn somefeature.wsp
需要注意的是,如果wsp没有添加到farm中,该函数将会失败。
The best thing that I have found to do is have a Power Shell that will wait for a pending timer job to complete before moving on to the next task, you can but a pause in however that requires you to check to make sure the time job is finished.
The trick is to poll the server using stsadm -o displaysolution -name . if the wsp is installed on the farm the command returns some xml, if there is a timer job for deployment there is a "SolutionDeploymentJob" tag in the xml. With a simple loop you can wait for a time job to finish
usage:
WaitForJobOn somefeature.wsp
it should be noted that the function will fail if the wsp is not added to the farm.
我也遇到了这个问题。 我解决这个问题的唯一方法是每次部署/撤回之前重新启动 Windows SharePoint Services 管理服务。
更新:我重新启动了 WFE 服务器,这个问题就消失了。 我希望我能了解更多原因,但经典的 Microsoft 重启解决方案再次流行。
这很烦人。
另一个更新:我刚刚发布了一个名为 smartexecjobdefs 的 stsadm 命令,该命令解决了这个问题。 在这篇博客文章中,我谈论了一个作业定义执行器返回控制权之前监视正在运行的作业的完成情况。 此 stsadm 命令只是包装此类。
I am also running into this problem. The only way I've gotten around it is to restart the Windows SharePoint Services Administration service each time before a deployment/retraction.
UPDATE: I rebooted the WFE server and this problem has disappeared. I wish I had more info why, but the classic Microsoft reboot solution prevails again.
It is very annoying.
ANOTHER UPDATE: I just released an stsadm command called smartexecjobdefs that addresses this issue. In this blog post, I talk about a Job Definition Executor that monitors for the completion of running jobs before returning control. This stsadm command simply wraps this class.
您需要在部署解决方案和尝试激活功能之间暂停 - 这有点竞争条件。
更多:如果有多个网络前端,并且连接速度很慢,或者服务器很忙,或者任何其他导致此类事情需要一些时间的事情 - 那么你就会遇到麻烦。 批处理文件无法处理它 - Powershell 脚本可以使用对象模型来检查解决方案是否真正部署,然后再继续。
You need to pause between deploying your solution and trying to activate your features - it's a bit of a race condition.
More: If there are several web front ends, and connectivity is slow, or the servers are busy, or any number of other things that cause this sort of thing to take some time - then you run into trouble. Batch files can't deal with it - a Powershell script could use the object model to check if a solution is truly deployed before moving on.
我也遇到过这个问题。 每次我尝试部署解决方案时,都会复制一些文件,然后在复制所有文件之前会因此错误而停止。 我没有任何证据,但我相信服务器上的防病毒软件锁定了文件并进行干扰。
在我多次尝试部署该解决方案后(每次都比之前复制更多文件),它最终起作用了。
I've also had this problem. Every time I tried to deploy the solution some of the files were copied then it stopped with this error before copying all of them. I don't have any evidence but I believe the anti-virus software on the server was locking the files and interfering.
It eventually worked after I attempted to deploy the solution several times (each time copying a few more files than the time before).
我发现在具有多个 Web 前端服务器的 SharePoint 场中使用 Windows SharePoint Administration Service (SPAdmin) 时,SP1 中的 Windows SharePoint Administration Service (SPAdmin) 偶尔会失败。
我建议禁用 spadmim 并使用 psexec 等远程执行工具运行 stsadm -o execadmsvcjobs。
示例:
psexec.exe @serverlist.txt "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN\stsadm.exe" -o execadmsvcjobs
I find Windows SharePoint Administration Service (SPAdmin) fails sporadically in sp1 when used in a SharePoint farm with multiple web front end servers.
I suggest disabling spadmim and run stsadm -o execadmsvcjobs using remote execution tool such as psexec.
Example:
psexec.exe @serverlist.txt "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN\stsadm.exe" -o execadmsvcjobs