從 AWS Web 服務散發 Windows 10 應用程式Distribute a Windows 10 app from an AWS web service

應用程式安裝程式可讓開發人員和 IT 專業人員透過在他們自己的內容傳遞網路 (CDN) 上,散發 Windows 10 應用程式。The App Installer app allows developers and IT Pros to distribute Windows 10 apps by hosting them on their own Content Delivery Network (CDN). 這對於不想要或不需要發佈其應用程式至 Microsoft Store ,但仍然想要利用 Windows 10 封裝與部署平台的企業而言,是很實用的。This is useful for enterprises that don't want or need to publish their apps to the Microsoft Store, but still want to take advantage of the Windows 10 packaging and deployment platform.

本主題概述設定 Amazon Web Services (AWS)網站以裝載 Windows 10 應用程式套件的步驟,以及如何使用 App Installer 應用程式來安裝應用程式套件。This topic outlines the steps to configure an Amazon Web Services (AWS) website to host Windows 10 app packages, and how to use the App Installer app to install the app packages.

安裝程式Setup

為成功遵循本教學課程,您需要:To successfully follow this tutorial, you will need the following:

  1. AWS 訂用帳戶AWS subscription
  2. 網頁Web page
  3. Windows 10 應用程式套件-您將發佈的應用程式套件Windows 10 app package - The app package that you will distribute

選用:在 GitHub 上的入門專案Optional: Starter Project on GitHub. 如果您沒有要使用的應用程式套件或網頁,但仍然想要了解如何使用這項功能,這會很有幫助。This is helpful if you don't an app package or web page to work with, but would still like to learn how to use this feature.

本教學課程將說明如何在 AWS 上設定網頁和主機封裝。This tutorial will go over how to setup a web page and host packages on AWS. 這將需要 AWS 訂用帳戶。This will require an AWS subscription. 視您的作業規模而定,您可以使用其免費成員資格來遵循此教學課程。Depending on the scale of your operation, you can use their free membership to follow this tutorial.

步驟 1-AWS 成員資格Step 1 - AWS membership

若要取得 AWS 成員資格,請造訪AWS 帳戶詳細資料頁面To get an AWS membership, visit the AWS account details page. 基於本教學課程的目的,您可以使用免費的會員資格。For the purposes of this tutorial, you can use a free membership.

步驟 2-建立 Amazon S3 bucketStep 2 - Create an Amazon S3 bucket

Amazon Simple Storage Service (S3)是 AWS 的供應專案,可用於收集、儲存和分析資料。Amazon Simple Storage Service (S3) is an AWS offering for collecting, storing and analyzing data. S3 值區是裝載 Windows 10 應用程式套件和網頁以進行散發的便利方式。S3 buckets are a convenient way to host Windows 10 app packages and web pages for distribution.

使用您的認證登入 AWS 之後,請在 Services 尋找 S3After logging in to AWS with your credentials, under Services find S3.

選取 [建立 bucket],然後為您的網站輸入值區名稱Select Create bucket, and enter a Bucket name for your website. 遵循對話方塊的提示來設定屬性和許可權。Follow the dialog prompts for setting properties and permissions. 為確保您的 Windows 10 應用程式可以從您的網站散發,請啟用您的 bucket 的 [讀取] 和 [寫入] 許可權,然後選取 [授與此 bucket 的公用讀取權限]。To ensure that your Windows 10 app can be distributed from your website, enable Read and Write permissions for your bucket and select Grant public read access to this bucket.

在 Amazon S3 bucket 上設定許可權

請檢查摘要,以確定已反映選取的選項。Review the summary to make sure the selected options are reflected. 按一下 [建立 bucket ] 以完成此步驟。Click Create bucket to finish this step.

步驟 3-將 Windows 10 應用程式套件和網頁上傳至 S3 bucketStep 3 - Upload Windows 10 app package and web pages to an S3 bucket

您已建立 Amazon S3 bucket,您就可以在 Amazon S3 視圖中看到它。One you have created an Amazon S3 bucket, you will be able to see it in your Amazon S3 view. 以下是示範 bucket 外觀的範例:Here's an example of what our demo bucket looks like:

Amazon S3 bucket 視圖的螢幕擷取畫面

我們現在已準備好上傳要在 Amazon S3 bucket 中裝載的應用程式套件和網頁。We are now ready to upload the app packages and web pages that we would like to host in our Amazon S3 bucket.

按一下新建立的 bucket 來上傳內容。Click on the newly created bucket to upload content. 此值區目前是空的,因為尚未上傳任何內容。The bucket is currently empty since nothing has been uploaded yet. 按一下 [上傳] 按鈕,然後選取您想要上傳的應用程式套件和網頁檔案。Click the Upload button and select the app packages and web page files that you like to upload.

注意

如果您沒有可使用的應用程式套件,您可以使用 GitHub 上屬於所提供入門專案存放庫一部分的應用程式套件。You can use the app package that is part of the provided Starter Project repository on GitHub if you don't have an app package available. 簽署套件的憑證 (MySampleApp.cer) 也是在 GitHub 上的範例。The certificate (MySampleApp.cer) that the package was signed with is also with the sample on GitHub. 您必須在安裝應用程式之前安裝憑證到您的裝置。You must have the certificate installed to your device prior to installing the app.

上傳應用程式套件 UX 的螢幕擷取畫面

類似于建立 Amazon S3 bucket 的許可權,此值區中的內容也必須具有讀取寫入,以及授與此物件使用權限的公用讀取許可權。Similar to the permissions for creating an Amazon S3 bucket, the content in the bucket must also have read, write, and Grant public read access to this object(s) permissions.

如果您想要測試上傳網頁,但沒有它,您可以使用入門專案中的範例 html 網頁(.html)。If you would like to test uploading a web page, but don't have one, you can use the sample html page (default.html) from the Starter Project.

重要

在您上傳網頁之前,請確認您網頁中的應用程式套件參考正確。Before you upload the web page, confirm that the app package reference in your web page is correct.

若要取得應用程式套件參考,請先上傳應用程式套件,並複製應用程式套件 URL。To get the app package reference, upload the app package first and copy the app package URL. 編輯 html 網頁以反映正確的應用程式套件路徑。Edit the html web page to reflect the correct app package path. 如需詳細資訊,請參閱程式碼範例。See the code example for more details.

選取已上傳的應用程式套件檔案,以取得應用程式套件的參考連結。Select the uploaded app package file to get the reference link to the app package.

將連結複製到應用程式套件,並在您的網頁中新增參考。Copy the link to the app package and add the reference in your web page.

<html>
    <head>
        <meta charset="utf-8" />
        <title> Install My Sample App</title>
    </head>
    <body>
        <a href="ms-appinstaller:?source=https://s3-us-west-2.amazonaws.com/appinstaller-aws-demo/MySampleApp.msixbundle"> Install My Sample App</a>
    </body>
</html>

將 html 檔案上傳到您的 Amazon S3 bucket。Upload the html file to your Amazon S3 bucket. 請記得將許可權設定為允許讀取寫入存取。Remember to set the permissions to allow read and write access.

步驟 4-測試Step 4 - Test

將網頁上傳到您的 Amazon S3 bucket 之後,請選取上傳的 html 檔案以取得網頁的連結。Once the web page is uploaded into your Amazon S3 bucket, get the link to the web page by selecting the uploaded html file.

使用連結來開啟網頁。Use the link to open the web page. 由於我們設定許可權授與應用程式套件和網頁的公用存取權,因此任何具有網頁連結的人都可以存取它,並使用應用程式安裝程式來安裝您的 Windows 10 應用程式套件。Since we set permissions to grant public access to the app package and web page, anyone with the link to the web page will be able to access it and install your Windows 10 app packages using App Installer. 請注意,應用程式安裝程式是 Windows 10 平臺的一部分。Note that App Installer is part of the Windows 10 platform. 身為開發人員,您不需要在應用程式中新增任何額外程式碼或功能,即可使用應用程式安裝程式。As a developer, you do not need to add any additional code or features to your app to enable the use of App Installer.

疑難排解Troubleshooting

應用程式安裝程式無法安裝App Installer fails to install

如果未在裝置上安裝應用程式套件簽署的憑證,應用程式安裝將會失敗。App installation will fail if the certificate that the app package is signed with isn't installed on the device. 若要修正這個問題,您必須在安裝應用程式之前安裝憑證。To fix this, you will need to install the certificate prior to the installation of the app. 如果您要裝載公用發佈的應用程式套件,建議使用憑證授權單位單位的憑證來簽署您的應用程式套件。If you are hosting an app package for public distribution, it's recommended to sign your app package with a certificate from a certificate authority.