設定 SharePoint Server 相關應用程式的環境Configure an environment for apps for SharePoint Server

摘要: 設定 SharePoint Server 2016 和 SharePoint Server 2013 應用程式的網域名稱、服務應用程式與 URL。Summary: Configure domain names, service applications, and URLs for apps for SharePoint Server 2016 and SharePoint Server 2013.

若要讓使用者在網站中安裝並使用 SharePoint 應用程式,您必須設定環境予以支援。本文說明如何設定環境以支援應用程式。可利用<規劃 SharePoint Server 的應用程式>文章檢閱選項,然後決定本文中組態設定要採用的值。To enable users to install and use apps for SharePoint in their sites, you must configure your environment to support them. This article describes how to configure your environment to support apps. Use the Plan for apps for SharePoint Server article to review options and determine the values to use for configuration settings in this article.

開始之前Before you begin

  • 您必須向網域名稱提供者購買網域名稱以用於應用程式,例如 ContosoApps.com。You must purchase a domain name from a domain name provider for your apps, for example, ContosoApps.com.

  • 您必須是伺服器陣列管理員群組的成員,才可執行本文中的步驟。有些步驟必須是網域系統管理員身分才能執行。You must be a member of the Farm Administrators group to perform the steps in this article. For some steps, you must also be a domain administrator.

  • 如果您有多租用戶環境,則必須使用 Microsoft PowerShell 執行一些步驟。請確定您有權限可使用 Windows PowerShell 來管理 SharePoint 伺服器If you have a multi-tenant environment, you need to do some steps by using Microsoft PowerShell. Make sure you have permissions to administer SharePoint Server using Windows PowerShell.

在 DNS 中設定網域名稱Configure the domain names in DNS

您必須在網域名稱服務 (DNS) 中設定用來裝載應用程式的新網域。為了協助改善安全性,網域名稱不能是主控 SharePoint Server 網站之網域的子網域。例如,如果 SharePoint Server 網站位於 Contoso.com,請考慮使用 ContosoApps.com 而非 App.Contoso.com 來作為網域名稱。You must configure a new domain in Domain Name Services (DNS) to host the apps. To help improve security, the domain name should not be a subdomain of the domain that hosts the SharePoint Server sites. For example, if the SharePoint Server sites are at Contoso.com, consider ContosoApps.com instead of App.Contoso.com as the domain name.

應用程式在佈建時會佈建唯一的 DNS 網域名稱 (例如,Apps- 12345678ABCDEF.ContosoApps.com,其中 12345678ABCDEF 是應用程式的唯一識別碼)。您必須為 DNS 網域提供萬用字元正式名稱 (CNAME) 項目,以支援這些唯一名稱。When an app is provisioned, it provisions a unique DNS domain name (for example, Apps- 12345678ABCDEF.ContosoApps.com, where 12345678ABCDEF is a unique identifier for the app). You need a wildcard Canonical Name (CNAME) entry for your DNS domain to support these unique names.

視您的設定而定 (例如,若使用 WINS 正向對應),可能需要先建立新的正向對應區域,或者可以在與 SharePoint Server 網站網域相同的區域中先建立萬用字元 CNAME 項目。在下列程序中,您將建立正向對應區域,然後建立 DNS 網域名稱的萬用字元別名記錄,這可讓個別應用程式在應用程式網域內建立唯一的網域名稱。在這些程序中,我們使用 Windows Server 2012 R2 的 DNS 管理員。若您有其他類型的 DNS 伺服器,請遵循文件中針對該伺服器類型的程序。Depending on your configuration (for example, if you are using WINS forward lookup), you might have to create a new forward lookup zone first, or you can start with a wildcard CNAME entry in the same zone as the SharePoint Server site domain. In the following procedures, you create a forward lookup zone, and then create a wildcard alias record for the DNS domain name that allows for individual apps to create unique domain names within your app domain. In these procedures, we use DNS Manager for Windows Server 2012 R2. If you have a different type of DNS server, follow the procedures in the documentation for that server type.

建立應用程式網域名稱的正向對應區域To create a forward lookup zone for the app domain name

  1. 確認執行此程序的使用者帳戶是網域控制站的網域系統管理員。Verify that the user account that performs this procedure is a domain administrator on the domain controller.

  2. 按一下 [開始]*,然後指向 [系統管理工具],再按一下 [DNS]Click *Start, point to Administrative Tools, and then click DNS.

  3. 在「DNS 管理員」的 [正向對應區域] 上按一下滑鼠右鍵,然後按一下 [新區域...]。In DNS Manager, right-click Forward Lookup Zones, and then click New Zone….

  4. 在 [新區域精靈] 中,按 [下一步] 。In the New Zone Wizard, click Next.

  5. 在「區域類型」頁面中,接受 [主要區域] 的預設值,然後按 [下一步]。In the Zone Type page, accept the default of Primary zone, and then click Next.

  6. 在「Active Directory 區域複寫領域」頁面中,為您的環境選擇合適的複寫方法 (預設為 [複寫至此網域中的所有 DNS 伺服器] ),然後按 [下一步]。In the Active Directory Zone Replication Scope page, select the appropriate replication method for your environment (the default is To all DNS servers in this domain), and then click Next.

  7. 在「區域名稱」頁面的 [區域名稱] 方塊中,輸入新的應用程式網域名稱 (例如 ContosoApps.com),然後按 [下一步]。In the Zone Name page, in the Zone name box type the name for your new app domain name (for example, ContosoApps.com), and then click Next.

  8. 在「動態更新」頁面中,為您的環境選擇合適的動態更新類型 (預設為 [不允許動態更新] ),然後按 [下一步]。On the Dynamic Update page, select the appropriate type of dynamic updates for your environment (the default is Do not allow dynamic updates), and then click Next.

  9. 在 [完成新區域精靈]**** 頁面上,檢視設定,然後按一下 [完成]*On the *Completing the New Zone Wizard page, review the settings, and then click Finish.

您已在環境中建立正向對應區域 (與網域名稱),現在即可用於應用程式 。You have now created a forward lookup zone (and a domain name) to use for apps in your environment.

為新網域名稱建立萬用字元別名 (CNAME) 記錄To create a wildcard Alias (CNAME) record for the new domain name

  1. 確認執行此程序的使用者帳戶是網域控制站的網域系統管理員。Verify that the user account that performs this procedure is a domain administrator on the domain controller.

  2. 在「DNS 管理員」的「正向對應區域」下,於新應用程式的網域名稱上按滑鼠右鍵,然後按一下 [新別名 (CNAME)]*In DNS Manager, under Forward Lookup Zones, right-click the new app domain name, and then click *New Alias (CNAME).

  3. 在 [新增資源記錄] 對話方塊的 [別名名稱]**** (若留白,系統將使用父系網域) 方塊中,輸入 *。In the New Resource Record dialog box, in the Alias name (uses parent domain if left blank) box, type **.

    完整網域名稱 (FQDN) 方塊顯示 *.,後面加上您為應用程式建立的網域名稱,例如:*.ContosoApps.com 或 *.Contoso-Apps.com。The Fully qualified domain name (FQDN) box displays *. followed by the domain name that you created for apps. For example, *.ContosoApps.com or *.Contoso-Apps.com.

  4. 在 [目標主機完整網域名稱 (FQDN)]**** 方塊旁,輸入主控 SharePoint Server 網站之伺服器的 FQDN。Next to the Fully qualified domain name (FQDN) for target host box, type the FQDN of the server that hosts the SharePoint sites.

    例如 SharePoint.Contoso.com。For example, SharePoint.Contoso.com.

    或者:Or:

  5. 在 [目標主機的完整網域名稱 (FQDN)]**** 方塊旁邊按一下 [瀏覽]*,然後瀏覽至主控 SharePoint Server 網站網域的「正向對應區域」。Next to the *Fully qualified domain name (FQDN) for target host box, click Browse and navigate to the Forward Lookup Zone for the domain that hosts the SharePoint sites.

    例如,contoso.com。For example, Contoso.com.

  6. 然後瀏覽到指向主控 SharePoint Server 網站伺服器的記錄。And then navigate to the record that points to the server that hosts the SharePoint Server site.

    例如 SharePoint。For example, SharePoint.

    [新增資源記錄] 對話方塊將顯示應用程式網域的萬用字元別名,以及主控 SharePoint 網站之伺服器的 FQDN。New Resource Record dialog box shows the wildcard alias for the app domain and the FQDN of the server that hosts the SharePoint sites.

    建立適用於應用程式網域的 CNAME 別名

  7. 按一下 [確定]*Click *OK.

您可 Ping 新網域名稱與別名來驗證。You can verify the new domain name and alias by pinging them.

驗證新網域名稱To verify the new domain name

  1. 確認正在執行此程序的使用者帳戶為網域控制站的網域系統管理員。Verify that the user account that is performing this procedure is a domain administrator on the domain controller.

  2. 按一下 [開始],然後按一下 [命令提示字元]。Click Start, and then click Command Prompt.

  3. 在命令提示字元處輸入 ping ,接著輸入您建立的網域子網域,然後按下 ENTERAt the command prompt, type ping followed by a subdomain of the domain that you created, and then press ENTER.

    例如 ping Apps-12345678ABCDEF.contosoapps.comFor example, ping Apps-12345678ABCDEF.contosoapps.com

    若 Ping 命令傳回正確的 IP 位址,代表您的網域名稱萬用字元已設定成功。If the ping command returns the correct IP address, then your wildcard for the domain name was configured successfully.

建立新的萬用字元 SSL 憑證Create a new wildcard SSL certificate

若在環境中的 SharePoint Server 網站上使用安全通訊端層 (SSL),或使用任何會使用 SharePoint Server 網站外部資料的應用程式,就應該對應用程式使用 SSL。若要使用 SSL,您需要針對應用程式網域建立 SSL 憑證 (例如 ContosoApps.com)。If you are using Secure Sockets Layer (SSL) for the SharePoint Server sites in your environment, or if you use any apps that use data external to the SharePoint Server sites, you should use SSL for your apps. To use SSL, you create an SSL certificate for your app domain (for example, ContosoApps.com).

必須以萬用字元的格式新增網域 (例如 *.ContosoApps.com)。您需要萬用字元憑證,而不是個別的憑證,因為各個安裝的應用程式都有專屬的子網域。The domain should be added in the form of a wildcard (for example, *.ContosoApps.com). You need a wildcard certificate instead of individual certificates because each installed app has its own subdomain.

請注意,為了要允許支援使用 SharePoint Server 應用程式網域來進行 SSL 卸載,您必須使用下列 Microsoft PowerShell 命令,啟用對多個應用程式網域的支援︰Note that in order to allow support for SSL offloading with SharePoint Server App Domains you must enable support for multiple app domains by using the following Microsoft PowerShell commands:

$contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    $contentService.SupportMultipleAppDomains = $true
    $contentService.Update()
    Iisreset

設定訂閱設定與應用程式管理服務應用程式Configure the Subscription Settings and App Management service applications

應用程式需依賴 App Management 和 Microsoft SharePoint Foundation 訂閱設定服務應用程式。請使用下列程序來為其進行設定。Apps rely on the App Management and Microsoft SharePoint Foundation Subscription Settings service applications. Use the following procedures to configure them.

開啟 Microsoft SharePoint Foundation 訂閱設定服務To turn on the Microsoft SharePoint Foundation Subscription Settings Service

  1. 在管理中心的 [系統設定]**** 下方,按一下 [管理此伺服器陣列中的服務]*In Central Administration, under *System Settings, click Manage services in this farm.

  2. 在 [Microsoft SharePoint Foundation 訂閱設定服務]**** 中按一下 [啟用自動佈建]*For the *Microsoft SharePoint Foundation Subscription Settings Service, click Enable Auto Provision

接下來,建立訂閱設定服務應用程式和 Proxy。您必須使用 Microsoft PowerShell 來建立這些項目。請使用 New-SPSubscriptionSettingsServiceApplication 所提供的指令碼範例。Next, create a Subscription Settings service application and proxy. These must be created by using Microsoft PowerShell. Use the example script provided at New-SPSubscriptionSettingsServiceApplication.

您還需要 App Management 服務應用程式。下列程序會提供其設定步驟。You also need an App Management service application. The following procedures provide the steps to configure it.

建立 App Management 服務應用程式To create a App Management service application

  1. 在管理中心中,按一下 [應用程式管理]**** 下的 [管理服務應用程式]*In Central Administration, in *Application Management section, click Manage service applications.

  2. 按一下 [新增]*,然後按一下 [App Management 服務]Click **New, and then click **App Management Service*.

  3. 在 [服務應用程式名稱]**** 方塊中,輸入服務應用程式的名稱。Type a name for the service application in the Service Application Name box.

  4. 在 [應用程式集區]**** 底下,從 [使用現有的應用程式集區]**** 清單中選擇 [SharePoint Web 服務預設值]*Under *Application Pool, choose SharePoint Web Services Default from the Use existing application pool list.

  5. 按一下 [確定]*Click *OK.

指定應用程式網域和應用程式前置詞Specify the app domain and app prefix

在此區段中,您可以指定要用於環境中應用程式的應用程式網域和應用程式前置詞。應用程式 URL 會指向應用程式網域以及用以決定每個應用程式命名方式的前置詞。In this section, you specify the app domain and app prefix to use for apps in your environment. The app URL points to your app domain and a prefix that determines how each app is named.

請使用下列程序來設定應用程式 URL。Use the following procedure to configure app URLs.

設定應用程式 URLTo configure app URLs

  1. 在管理中心按一下 [應用程式]*In Central Administration, click *Apps.

  2. 在 [應用程式]**** 頁面按一下 [設定應用程式 URL]*On the *Apps page, click Configure App URLs.

  3. 在 [應用程式網域]**** 方塊中,輸入您為主控應用程式建立的隔離網域 (例如,ContosoApps.com)。In the App domain box, type the isolated domain that you created for hosting apps (for example, ContosoApps.com).

  4. 在 [應用程式前置詞]**** 方塊中,輸入要作為應用程式 URL 前置詞的名稱。In the App prefix box, type a name to use for the URL prefix for apps.

    (例如,您可以使用「apps」來作為前置詞,然後您就會看到每個應用程式的 URL,例如「apps- 12345678ABCDEF.ContosoApps.com」。)(For example, you could use "apps" as the prefix, and you would see a URL for each app such as "apps- 12345678ABCDEF.ContosoApps.com".)

  5. 按一下 [確定]*Click *OK.

  6. 如果您要安裝應用程式而且您已經變更應用程式前置詞 (又稱為網站訂閱名稱),您必須執行與重新啟動主控應用程式之 World Wide Web Publishing 服務 (WWW 服務) 關聯的額外步驟。If you will install apps and you have changed the App prefix (also known as the site subscription name), you must perform additional steps that involve restarting the World Wide Web Publishing Service (WWW Service) that hosts the apps.

    重要

    重新啟動 WWW 服務也會重新啟動 IIS 系統管理服務與 Windows 處理序啟用服務,並且會關閉所有依賴這些服務的網站和應用程式。這可能會使它們遺失現有的狀態,要等成功重新啟動服務後才能再次使用。您應該規劃在計劃的維修時間執行這些步驟。 > 若要完成應用程式前置詞重新命名工作,請執行這些步驟: > 停止 SharePoint Timer Service。 > 重新啟動主控應用程式的 World Wide Web Publishing 服務。 > 啟動 SharePoint Timer Service。Restarting the WWW Service will also restart the IIS Admin Service and the Windows Process Activation Service. This will also shut down all Web sites and applications that depend on these services and they may lose existing state and will be unavailable until the services successfully restart. You should plan to perform these steps during a planned maintenance time. > To complete the App prefix rename tasks, perform these steps: > Stop the SharePoint Timer service. > Restart the World Wide Web Publishing Service that hosts the apps. > Start the SharePoint Timer service.

多租用戶設定 (選擇性)Multi-tenant settings (Optional)

如果您在環境中裝載多個租用戶,則必須使用 Microsoft PowerShell 來設定每個租用戶的應用程式 URL。請使用下列程序來為其進行設定。If you host multiple tenants in your environment, you must use Microsoft PowerShell to configure app URLs for each tenant. Use the following procedure to configure them.

使用 Windows PowerShell 設定應用程式 URLTo configure app URLs by using Windows PowerShell

  1. 開啟 [SharePoint 管理命令介面]。Open the SharePoint Management Shell.

  2. 在 Microsoft PowerShell 命令提示字元處輸入以下命令,並在每個命令結尾按下 ENTERAt the Microsoft PowerShell command prompt, type the following commands and press ENTER after each one:

    Set-SPAppDomain <appDomain>
    
    Set-SPAppSiteSubscriptionName -Name "app" -Confirm:$false
    

    其中:Where:

    • <應用程式網域> 是您建立的網域名稱。<appDomain> is the domain name that you created.
  3. 如果您要安裝應用程式而且您已經變更應用程式前置詞 (又稱為網站訂閱名稱),您必須執行與重新啟動主控應用程式之 World Wide Web Publishing 服務 (WWW 服務) 關聯的額外步驟。If you will install apps and you have changed the App prefix (also known as the site subscription name), you must perform additional steps that involve restarting the World Wide Web Publishing Service (WWW Service) that hosts the apps.

    重要

    重新啟動 WWW 服務也會重新啟動 IIS 系統管理服務與 Windows 處理序啟用服務,並且會關閉所有依賴這些服務的網站和應用程式。這可能會使它們遺失現有的狀態,要等成功重新啟動服務後才能再次使用。您應該規劃在計劃的維修時間執行這些步驟。 > 若要完成應用程式前置詞重新命名工作,請執行這些步驟: > 停止 SharePoint Timer Service。 > 重新啟動主控應用程式的 World Wide Web Publishing 服務。 > 啟動 SharePoint Timer Service。Restarting the WWW Service will also restart the IIS Admin Service and the Windows Process Activation Service. This will also shut down all Web sites and applications that depend on these services and they may lose existing state and will be unavailable until the services successfully restart. You should plan to perform these steps during a planned maintenance time. > To complete the App prefix rename tasks, perform these steps: > Stop the SharePoint Timer service. > Restart the World Wide Web Publishing Service that hosts the apps. > Start the SharePoint Timer service.

如需詳細資訊,請參閱<Set-SPAppSiteSubscriptionName>及<Set-SPAppDomain>。For more information, see Set-SPAppSiteSubscriptionName and Set-SPAppDomain.

設定網際網路對向端點功能 (選用)Configure the Internet-facing endpoints feature (Optional)

SharePoint 市集中包含搭配需要網際網路對向端點之網站使用的 SharePoint 應用程式。依預設,這些應用程式並無法使用 (灰階化無法購買),因為它們與大多數的網站都無法相容。不過,如果您伺服器陣列的設定允許網際網路對向端點,則您可開啟網際網路對向端點功能,以顯示 SharePoint 市集中的應用程式。您可在管理中心開啟此功能。The SharePoint Store contains apps for SharePoint intended for use with sites that require Internet-facing endpoints. By default, these apps are not available (greyed out and cannot be purchased) because they are incompatible with most sites. However, if your farm is configured to allow internet-facing end points, you can turn on the Internet-facing endpoints feature to show these apps in the SharePoint Store. You turn this feature on in Central Administration.

設定應用程式的網際網路對向端點To configure Internet-facing endpoints for apps

  1. 在管理中心中,按一下 [應用程式管理]*In Central Administration, click *Application Management.

  2. 在「應用程式管理」頁面上,按一下 [管理 Web 應用程式]。On the Application Management page, click Manage Web applications.

  3. 在「管理 Web 應用程式」頁面上,選取要變更的 Web 應用程式。On the Manage Web Applications page, select the web application that you want to change.

  4. 在功能區上,按一下 [管理功能]。On the ribbon, click Manage Features.

  5. 在功能清單中,按一下 [需要可存取網際網路對向端點的應用程式] 旁的 [啟動]。In the feature list, next to Apps that require accessible internet facing endpoints, click Activate.

  6. 按一下 [確定]*Click *OK.

在某些情況下,例如,當您具有不常安裝更新的內部部署 SharePoint Server 陣列時,您必須執行 Cmdlet 來更新用來指向 SharePoint 市集 的 URL:In some cases, for example, when you have an on-premises SharePoint Server farm where updates are installed infrequently, you will need to run a cmdlet to update the URL used to point to the SharePoint Store:

Set-SPAppStoreConfiguration -Url http://office.microsoft.com -Enable $true

另請參閱See also

概念Concepts

規劃 SharePoint Server 的應用程式Plan for apps for SharePoint Server

安裝及管理 SharePoint Server 的應用程式Install and manage apps for SharePoint Server