2013-03-28 68 views
1

我在SharePoint 2013服務器場中遇到問題。我有一個腳本來在我的服務器場中創建Web應用程序,但是當我這樣做時,我無法在該Web應用程序內創建發佈網站集。 (原帖在這裏:https://sharepoint.stackexchange.com/questions/64308/fails-to-create-publishing-site-collection-in-scripted-web-application未能在腳本化Web應用程序中創建發佈網站集合

所以,環境的設置是這樣的:

  1. 我們正在使用主機頭的應用
  2. 我們在註冊表中設置了BackConnectionHostNames
  3. 現在。我們使用Farm admin賬戶來運行應用程序池
  4. 我們有mysites安裝程序並且顯然正在工作
  5. 沒有搜索設置
  6. 我們有一個內容類型集線器設置,顯然工作。

所以,症狀出現到我這個樣子:

  1. 我不能在我的新主機頭的基於Web的應用程序創建的發佈站點集合時,我從我的腳本創建它。當我通過圖形用戶界面創建發佈網站集時,它會說「正在處理它」一段時間,然後向我提供一個錯誤,同時還在旋轉「正在工作」。在事件日誌中有這樣的閱讀:

    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)) 
    
  2. 如果我創建Web應用程序從中央管理GUI,我可以成功地爲其創建一個發佈門戶。

  3. 如果我用我的腳本創建了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

嘗試以管理員身份從SharePoint Management Shell運行。我的腳本非常相似。確保AD中存在SuperUser和SuperReader帳戶。

在錯誤中,URL是空白的。

您的腳本將創建經典模式Web應用程序,而不是基於聲明的Web應用程序。

相關問題