我的SharePoint 2013服务器场出了问题。我有一个脚本在我的服务器场中创建Web应用程序,但是当我这样做时,我无法在该Web应用程序中创建发布网站集。 (最初发布在这里:https://sharepoint.stackexchange.com/questions/64308/fails-to-create-publishing-site-collection-in-scripted-web-application
因此,环境设置如下:
所以,症状就像这样出现在我身上:
当我从我的脚本创建发布网站集时,我无法在新的基于主机头的Web应用程序中创建发布网站集。当我通过GUI创建发布网站集时,它会说“正在处理它”一段时间,然后在仍在旋转“正在处理它”的同时向我显示错误。在事件日志中有这样的内容:
Event log message was: 'The site template was not provisioned successfully. Delete this
site collection in Central Administration, and then create a new site collection.'.
Exception was: 'Microsoft.SharePoint.SPException: Provisioning did not succeed. Details:
Failed to initialize some site properties for Web at Url: ''
OriginalException: Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED)) ---> System.UnauthorizedAccessException: Access is denied. (Exception
from HRESULT: 0x80070005 (E_ACCESSDENIED))
如果我从Central Admin GUI创建了Web应用程序,我可以在其中成功创建一个发布门户。
如果我使用我的脚本创建了Web应用程序,我可以成功创建一个团队网站。
下面是我的剧本,任何人都可以看到一些明显错误的东西吗?我忘记了CA GUI负责的事情吗?
$ver = $host | select version
if ($ver.Version.Major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"}
Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
Import-Module WebAdministration -ErrorAction SilentlyContinue
Function CreateWebApplication($WebApplicationURL, $HttpPort, $WebApplicationName,
$ContentDatabase, $ApplicationPoolDisplayName,
$ApplicationPoolIdentity, $ApplicationPoolPassword,
$PortalSuperReader, $PortalSuperUser) {
Write-Progress -Activity "Creating Web Application" -Status "Creating Web Application $WebapplicationURL"
if($WebApplicationURL.StartsWith("http://"))
{
$HostHeader = $WebApplicationURL.Substring(7)
$HTTPPort = "80"
}
elseif($WebApplicationURL.StartsWith("https://"))
{
$HostHeader = $WebApplicationURL.Substring(8)
$HTTPPort = "443"
}
$AppPoolManagedAccount = Get-SPManagedAccount $ApplicationPoolIdentity
$AuthenticationProvider = New-SPAuthenticationProvider –UseWindowsIntegratedAuthentication
#Create a new web application using the existing parameters, assign it to the WebApp variable such that object cache user accounts can be configured
$WebApp = New-SPWebApplication -ApplicationPool $ApplicationPoolDisplayName -ApplicationPoolAccount $AppPoolManagedAccount.Username -AuthenticationProvider $AuthenticationProvider -Name $WebApplicationName -url $WebApplicationURL -port $HTTPPort -DatabaseName $ContentDatabase -HostHeader $HostHeader
Write-Progress -Activity "Creating Web Application" -Status "Configuring Object Cache Accounts"
#Assign Object Cache Accounts
$WebApp.Properties["portalsuperuseraccount"] = $PortalSuperUser
$WebApp.Properties["portalsuperreaderaccount"] = $PortalSuperReader
Write-Progress -Activity "Creating Web Application" -Status "Creating Object Cache User Policies for Web Application"
#Create a New Policy for the Super User
$SuperUserPolicy = $WebApp.Policies.Add($PortalSuperUser, "Portal Super User Account")
#Assign Full Control To the Super User
$SuperUserPolicy.PolicyRoleBindings.Add(
$WebApp.PolicyRoles.GetSpecialRole(
[Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl))
#Create a New Policy for the Super Reader
$SuperReaderPolicy = $WebApp.Policies.Add($PortalSuperReader, "Portal Super Reader Account")
#ASsign Full Read to the Super Reader
$SuperReaderPolicy.PolicyRoleBindings.Add(
$WebApp.PolicyRoles.GetSpecialRole(
[Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead))
Write-Progress -Activity "Creating Web Application" -Status "Updating Web Application Properties"
#Commit changes to the web application
$WebApp.update()
}
CreateWebApplication "http://add.ress.lan" 80 "Intranet 3"
"sp_intranet3_content" "Intranet3 Pool" "sp_farm" "P4sswd!"
"sp_superreader" "sp_superuser"
答案 0 :(得分:0)
尝试以管理员身份从SharePoint Management Shell运行。我的脚本非常相似。确保AD中存在SuperUser和SuperReader帐户。
在错误中,网址为空。
您的脚本是创建经典模式Web应用程序,而不是基于声明的Web应用程序。