快速入門:搭配使用 Azure Cache for Redis 與 ASP.NET Web 應用程式Quickstart: Use Azure Cache for Redis with an ASP.NET web app

在本快速入門中,您會使用 Visual Studio 2019 建立 ASP.NET Web 應用程式,並連線至 Azure Cache for Redis 以儲存資料和從快取擷取資料。In this quickstart, you use Visual Studio 2019 to create an ASP.NET web application that connects to Azure Cache for Redis to store and retrieve data from the cache. 接著,您會將應用程式部署到 Azure App Service。You then deploy the app to Azure App Service.

PrerequisitesPrerequisites

建立 Visual Studio 專案Create the Visual Studio project

  1. 開啟 Visual Studio,然後選取 [檔案] >[新增] > [專案] 。Open Visual Studio, and then and select File >New > Project .

  2. 在 [新增專案] 對話方塊中,執行下列步驟:In the New Project dialog box, take the following steps:

    建立專案

    a.a. 在 [範本] 清單中,展開 [Visual C#] 節點。In the Templates list, expand the Visual C# node.

    b.b. 選取 [雲端] 。Select Cloud .

    c.c. 選取 [ASP.NET Web 應用程式] 。Select ASP.NET Web Application .

    d.d. 確認已選取 [.NET Framework 4.5.2] 或更新版本。Verify that .NET Framework 4.5.2 or higher is selected.

    e.e. 在 [名稱] 方塊中,指定專案的名稱。In the Name box, give the project a name. 在此範例中,我們使用 ContosoTeamStatsFor this example, we used ContosoTeamStats .

    f.f. 選取 [確定] 。Select OK .

  3. 選取 [MVC] 做為專案類型。Select MVC as the project type.

  4. 確定 [驗證] 設定已指定為 [不需要驗證] 。Make sure that No Authentication is specified for the Authentication settings. 視您的 Visual Studio 版本而定,預設的 [驗證] 設定可能會是其他值。Depending on your version of Visual Studio, the default Authentication setting might be something else. 若要加以變更,請選取 [變更驗證] ,然後選取 [不需要驗證] 。To change it, select Change Authentication and then No Authentication .

  5. 選取 [確定] 可建立專案。Select OK to create the project.

建立快取Create a cache

接下來,請建立應用程式的快取。Next, you create the cache for the app.

  1. 若要建立快取,請登入 Azure 入口網站,然後選取 [建立資源] 。To create a cache, sign in to the Azure portal and select Create a resource.

    [建立資源] 在左側導覽窗格中反白顯示。

  2. 在 [新增] 頁面上選取 [資料庫] ,然後選取 [Azure Cache for Redis] 。On the New page, select Databases and then select Azure Cache for Redis.

    在 [新增] 上,[資料庫] 和 [Azure Cache for Redis] 會反白顯示。

  3. 在 [新的 Redis 快取] 頁面上,設定新快取的設定。On the New Redis Cache page, configure the settings for your new cache.

    設定Setting 建議的值Suggested value 描述Description
    DNS 名稱DNS name 輸入全域唯一名稱。Enter a globally unique name. 快取名稱必須是 1 到 63 個字元的字串,且只能包含數字、字母或連字號。The cache name must be a string between 1 and 63 characters that contains only numbers, letters, or hyphens. 名稱的開頭和結尾必須是數字或字母,且不可包含連續的連字號。The name must start and end with a number or letter, and can't contain consecutive hyphens. 您的快取執行個體 主機名稱 將是 <DNS name>.redis.cache.windows.netYour cache instance's host name will be <DNS name>.redis.cache.windows.net.
    訂用帳戶Subscription 下拉並選取您的訂用帳戶。Drop down and select your subscription. 這個新的 Azure Cache for Redis 執行個體建立所在的訂用帳戶。The subscription under which to create this new Azure Cache for Redis instance.
    資源群組Resource group 下拉並選取資源群組,或選取 [新建] 並輸入新的資源群組名稱。Drop down and select a resource group, or select Create new and enter a new resource group name. 用來建立快取和其他資源的資源群組名稱。Name for the resource group in which to create your cache and other resources. 將所有的應用程式資源放在一個資源群組中,您將可輕鬆地一併管理或刪除這些資源。By putting all your app resources in one resource group, you can easily manage or delete them together.
    位置Location 下拉並選取位置。Drop down and select a location. 選取其他將使用快取的服務附近的區域Select a region near other services that will use your cache.
    定價層Pricing tier 下拉並選取 定價層Drop down and select a Pricing tier. 快取的可用大小、效能和功能取決於定價層。The pricing tier determines the size, performance, and features that are available for the cache. 如需詳細資訊,請參閱 Azure Cache for Redis 概觀For more information, see Azure Cache for Redis Overview.
  4. 選取 [網路] 索引標籤,或按一下頁面底部的 [網路] 按鈕。Select the Networking tab or click the Networking button at the bottom of the page.

  5. 在 [網路功能] 索引標籤中,選取您的連線方法。In the Networking tab, select your connectivity method.

  6. 選取頁面底部的 [下一步:進階] 索引標籤,或按一下頁面底部的 [下一步:進階] 按鈕。Select the Next: Advanced tab or click the Next: Advanced button on the bottom of the page.

  7. 在基本或標準快取執行個體的 [進階] 索引標籤中,如果您想要啟用非 TLS 連接埠,請選取啟用切換。In the Advanced tab for a basic or standard cache instance, select the enable toggle if you want to enable a non-TLS port. 您也可以選擇要使用 Redis 版本 4 或 (預覽) 6。You can also select which Redis version you would like use, either 4 or (PREVIEW) 6.

    Redis 版本 4 或 6。

  8. 在高階快取執行個體的 [進階] 索引標籤中,設定非 TLS 連接埠、叢集和資料持續性的設定。In the Advanced tab for premium cache instance, configure the settings for non-TLS port, clustering, and data persistence. 您也可以選擇要使用 Redis 版本 4 或 (預覽) 6。You can also select which Redis version you would like use, either 4 or (PREVIEW) 6.

  9. 選取頁面底部的 [下一步:標記] 索引標籤,或按一下頁面底部的 [下一步:標記] 按鈕。Select the Next: Tags tab or click the Next: Tags button at the bottom of the page.

  10. 在 [標記] 索引標籤中,如果您想要分類資源,可以選擇性地輸入名稱和值。Optionally, in the Tags tab, enter the name and value if you wish to categorize the resource.

  11. 選取 [檢閱 + 建立]。Select Review + create. 您會移至 [檢閱 + 建立] 索引標籤,其中 Azure 會驗證您的組態。You're taken to the Review + create tab where Azure validates your configuration.

  12. 出現綠色的「通過驗證」訊息之後,請選取 [建立]。After the green Validation passed message appears, select Create.

建立快取需要一些時間。It takes a while for the cache to create. 您可以在 Azure Cache for Redis 的 [概觀] 頁面上監視進度。You can monitor progress on the Azure Cache for Redis Overview page. 當 [狀態] 顯示為 [執行中] 時,表示快取已可供使用。When Status shows as Running, the cache is ready to use.

從 Azure 入口網站擷取主機名稱、連接埠和存取金鑰Retrieve host name, ports, and access keys from the Azure portal

若要連線至 Azure Cache for Redis 執行個體,快取用戶端需要主機名稱、連接埠和快取金鑰。To connect to an Azure Cache for Redis instance, cache clients need the host name, ports, and a key for the cache. 某些用戶端可能會以稍有不同的名稱來參考這些項目。Some clients might refer to these items by slightly different names. 您可以從 Azure 入口網站取得主機名稱、連接埠和金鑰。You can get the host name, ports, and keys from the Azure portal.

  • 若要取得存取金鑰,請從快取的左側導覽中選取 [存取金鑰] 。To get the access keys, from your cache left navigation, select Access keys.

    Azure Cache for Redis 金鑰

  • 若要取得主機名稱和連接埠,請從快取的左側導覽中選取 [屬性] 。To get the host name and ports, from your cache left navigation, select Properties. 主機名稱的格式為 <DNS name>.redis.cache.windows.netThe host name is of the form <DNS name>.redis.cache.windows.net.

    Azure Redis 快取屬性

編輯 CacheSecrets.config 檔案To edit the CacheSecrets.config file

  1. 在您的電腦上建立名為 CacheSecrets.config 的檔案。將該檔案放在範例應用程式的原始程式碼不會加以簽入的位置。Create a file on your computer named CacheSecrets.config . Put it in a location where it won't be checked in with the source code of your sample application. 在本快速入門中,CacheSecrets.config 檔案位於 C:\AppSecrets\CacheSecrets.config 。For this quickstart, the CacheSecrets.config file is located at C:\AppSecrets\CacheSecrets.config .

  2. 編輯 CacheSecrets.config 檔案。Edit the CacheSecrets.config file. 然後,新增下列內容:Then add the following content:

    <appSettings>
        <add key="CacheConnection" value="<cache-name>.redis.cache.windows.net,abortConnect=false,ssl=true,allowAdmin=true,password=<access-key>"/>
    </appSettings>
    
  3. <cache-name> 取代為快取主機名稱。Replace <cache-name> with your cache host name.

  4. <access-key> 取代為快取的主要金鑰。Replace <access-key> with the primary key for your cache.

    提示

    您可以在金鑰輪替期間使用次要存取金鑰作為重新產生主要存取金鑰時的替代金鑰。You can use the secondary access key during key rotation as an alternate key while you regenerate the primary access key.

  5. 儲存檔案。Save the file.

更新 MVC 應用程式Update the MVC application

在本節中,您將更新應用程式,以支援會對 Azure Cache for Redis 顯示簡單測試的新檢視。In this section, you update the application to support a new view that displays a simple test against Azure Cache for Redis.

使用快取的應用程式設定來更新 web.config 檔案Update the web.config file with an app setting for the cache

當您在本機執行應用程式時, CacheSecrets.config 中的資訊會用來連線到您的 Azure Cache for Redis 執行個體。When you run the application locally, the information in CacheSecrets.config is used to connect to your Azure Cache for Redis instance. 稍後您會將此應用程式部署至 Azure。Later you deploy this application to Azure. 屆時,您將會在 Azure 中設定應用程式設定,以供應用程式用來擷取快取連線資訊,而不是這個檔案。At that time, you configure an app setting in Azure that the application uses to retrieve the cache connection information instead of this file.

由於 CacheSecrets.config 檔案不會隨著應用程式部署至 Azure,因此您只會在本機測試應用程式時使用它。Because the file CacheSecrets.config isn't deployed to Azure with your application, you only use it while testing the application locally. 請以最安全的方式保存這項資訊,以防止他人惡意存取快取資料。Keep this information as secure as possible to prevent malicious access to your cache data.

更新 web.config 檔案To update the web.config file

  1. 在 [方案總管] 中,按兩下 Web.config 檔案來加以開啟。In Solution Explorer , double-click the web.config file to open it.

    Web.config

  2. web.config 檔案中,尋找 <appSetting> 元素。In the web.config file, find the <appSetting> element. 然後,新增下列 file 屬性。Then add the following file attribute. 如果您使用不同檔案名稱或位置,請以這些值取代範例中顯示的值。If you used a different file name or location, substitute those values for the ones that are shown in the example.

  • 取代前: <appSettings>Before: <appSettings>
  • 取代後:<appSettings file="C:\AppSecrets\CacheSecrets.config">After: <appSettings file="C:\AppSecrets\CacheSecrets.config">

ASP.NET 執行階段會將外部檔案的內容與 <appSettings> 元素的標記合併。The ASP.NET runtime merges the contents of the external file with the markup in the <appSettings> element. 如果找不到指定的檔案,則執行階段會略過檔案屬性。The runtime ignores the file attribute if the specified file can't be found. 您的密碼 (您的快取的連接字串) 不會包含在應用程式的原始程式碼中。Your secrets (the connection string to your cache) aren't included as part of the source code for the application. 將 Web 應用程式部署至 Azure 時,不會部署 CacheSecrets.config 檔案。When you deploy your web app to Azure, the CacheSecrets.config file isn't deployed.

設定應用程式以使用 StackExchange.RedisTo configure the application to use StackExchange.Redis

  1. 若要將應用程式設定為使用適用於 Visual Studio 的 StackExchange.Redis NuGet 套件,請選取 [工具] > [NuGet 套件管理員] > [套件管理員主控台] 。To configure the app to use the StackExchange.Redis NuGet package for Visual Studio, select Tools > NuGet Package Manager > Package Manager Console .

  2. Package Manager Console 視窗執行下列命令:Run the following command from the Package Manager Console window:

    Install-Package StackExchange.Redis
    
  3. NuGet 套件會為您的用戶端應用程式下載並新增必要的組件參考,以利用 StackExchange.Azure Cache for Redis 用戶端來存取 Azure Cache for Redis。The NuGet package downloads and adds the required assembly references for your client application to access Azure Cache for Redis with the StackExchange.Azure Cache for Redis client. 如果您偏好使用強式命名的 StackExchange.Redis 用戶端程式庫版本,請安裝 StackExchange.Redis.StrongName 套件。If you prefer to use a strong-named version of the StackExchange.Redis client library, install the StackExchange.Redis.StrongName package.

更新 HomeController 和版面配置To update the HomeController and Layout

  1. 在 [方案總管] 中展開 [控制器] 資料夾,然後開啟 HomeController.cs 檔案。In Solution Explorer , expand the Controllers folder, and then open the HomeController.cs file.

  2. 在檔案頂端新增下列兩個 using 陳述式,以支援快取用戶端和應用程式設定。Add the following two using statements at the top of the file to support the cache client and app settings.

    using System.Configuration;
    using StackExchange.Redis;
    
  3. 將下列方法新增至 HomeController 類別,以支援會對新快取執行一些命令的新 RedisCache 動作。Add the following method to the HomeController class to support a new RedisCache action that runs some commands against the new cache.

    public ActionResult RedisCache()
    {
        ViewBag.Message = "A simple example with Azure Cache for Redis on ASP.NET.";
    
        IDatabase cache = Connection.GetDatabase();
    
        // Perform cache operations using the cache object...
    
        // Simple PING command
        ViewBag.command1 = "PING";
        ViewBag.command1Result = cache.Execute(ViewBag.command1).ToString();
    
        // Simple get and put of integral data types into the cache
        ViewBag.command2 = "GET Message";
        ViewBag.command2Result = cache.StringGet("Message").ToString();
    
        ViewBag.command3 = "SET Message \"Hello! The cache is working from ASP.NET!\"";
        ViewBag.command3Result = cache.StringSet("Message", "Hello! The cache is working from ASP.NET!").ToString();
    
        // Demonstrate "SET Message" executed as expected...
        ViewBag.command4 = "GET Message";
        ViewBag.command4Result = cache.StringGet("Message").ToString();
    
        // Get the client list, useful to see if connection list is growing...
        ViewBag.command5 = "CLIENT LIST";
        StringBuilder sb = new StringBuilder();
    
        var endpoint = (System.Net.DnsEndPoint)Connection.GetEndPoints()[0];
        var server = Connection.GetServer(endpoint.Host, endpoint.Port);
        var clients = server.ClientList();
    
        sb.AppendLine("Cache response :");
        foreach (var client in clients)
        {
            sb.AppendLine(client.Raw);
        }
    
        ViewBag.command5Result = sb.ToString();
    
        return View();
    }
    
    private static Lazy<ConnectionMultiplexer> lazyConnection = new Lazy<ConnectionMultiplexer>(() =>
    {
        string cacheConnection = ConfigurationManager.AppSettings["CacheConnection"].ToString();
        return ConnectionMultiplexer.Connect(cacheConnection);
    });
    
    public static ConnectionMultiplexer Connection
    {
        get
        {
            return lazyConnection.Value;
        }
    }
    
    
  4. 在 [方案總管] 中,展開 [檢視] > [共用] 資料夾。In Solution Explorer , expand the Views > Shared folder. 然後開啟 _Layout.cshtml 檔案。Then open the _Layout.cshtml file.

    將:Replace:

    @Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
    

    成為:with:

    @Html.ActionLink("Azure Cache for Redis Test", "RedisCache", "Home", new { area = "" }, new { @class = "navbar-brand" })
    

新增 RedisCache 檢視To add a new RedisCache view

  1. 在 [方案總管] 中,展開 [檢視] 資料夾,然後在 [主資料夾] 資料夾上按一下滑鼠右鍵。In Solution Explorer , expand the Views folder, and then right-click the Home folder. 選擇 [新增] > [檢視...] 。Choose Add > View... .

  2. 在 [新增檢視] 對話方塊中,輸入 RedisCache 作為檢視名稱。In the Add View dialog box, enter RedisCache for the View Name. 然後選取 [新增] 。Then select Add .

  3. 以下列程式碼取代 RedisCache.cshtml 檔案中的程式碼:Replace the code in the RedisCache.cshtml file with the following code:

    @{
        ViewBag.Title = "Azure Cache for Redis Test";
    }
    
    <h2>@ViewBag.Title.</h2>
    <h3>@ViewBag.Message</h3>
    <br /><br />
    <table border="1" cellpadding="10">
        <tr>
            <th>Command</th>
            <th>Result</th>
        </tr>
        <tr>
            <td>@ViewBag.command1</td>
            <td><pre>@ViewBag.command1Result</pre></td>
        </tr>
        <tr>
            <td>@ViewBag.command2</td>
            <td><pre>@ViewBag.command2Result</pre></td>
        </tr>
        <tr>
            <td>@ViewBag.command3</td>
            <td><pre>@ViewBag.command3Result</pre></td>
        </tr>
        <tr>
            <td>@ViewBag.command4</td>
            <td><pre>@ViewBag.command4Result</pre></td>
        </tr>
        <tr>
            <td>@ViewBag.command5</td>
            <td><pre>@ViewBag.command5Result</pre></td>
        </tr>
    </table>
    

在本機執行應用程式Run the app locally

根據預設,專案已設定為在 IIS Express 本機中裝載應用程式以進行測試和偵錯。By default, the project is configured to host the app locally in IIS Express for testing and debugging.

在本機執行應用程式To run the app locally

  1. 在 Visual Studio 中,選取 [偵錯] > [開始偵錯] 以在本機建置和啟動要測試和偵錯的應用程式。In Visual Studio, select Debug > Start Debugging to build and start the app locally for testing and debugging.

  2. 在瀏覽器中,選取導覽列上的 [Azure Cache for Redis 測試] 。In the browser, select Azure Cache for Redis Test on the navigation bar.

  3. 在下列範例中,Message 金鑰先前具有快取值,此值是在入口網站中使用 Azure Cache for Redis 主控台設定的。In the following example, the Message key previously had a cached value, which was set by using the Azure Cache for Redis console in the portal. 應用程式更新了該快取值。The app updated that cached value. 應用程式也已執行 PINGCLIENT LIST 命令。The app also executed the PING and CLIENT LIST commands.

    本機的簡單測試已完成

在 Azure 中發佈並執行Publish and run in Azure

在本機成功測試應用程式後,您可以將應用程式部署至 Azure 並在雲端執行。After you successfully test the app locally, you can deploy the app to Azure and run it in the cloud.

將應用程式發佈至 AzureTo publish the app to Azure

  1. 在 Visual Studio 的 [方案總管] 中,以滑鼠右鍵按一下專案節點。In Visual Studio, right-click the project node in Solution Explorer. 然後選取 [發佈] 。Then select Publish .

    發佈

  2. 選取 [Microsoft Azure App Service] 、選取 [新建] ,然後選取 [發佈] 。Select Microsoft Azure App Service , select Create New , and then select Publish .

    發佈至 App Service

  3. 在 [建立 App Service] 對話方塊中,進行下列變更:In the Create App Service dialog box, make the following changes:

    設定Setting 建議值Recommended value 描述Description
    應用程式名稱App name 使用預設值。Use the default. 應用程式名稱會是應用程式部署至 Azure 時的主機名稱。The app name is the host name for the app when it's deployed to Azure. 如有必要,該名稱中會新增時間戳記尾碼,以成為唯一名稱。The name might have a timestamp suffix added to it to make it unique if necessary.
    訂用帳戶Subscription 選擇 Azure 訂用帳戶。Choose your Azure subscription. 系統會就任何相關的裝載費用,對此訂用帳戶收費。This subscription is charged for any related hosting costs. 如果您有多個 Azure 訂用帳戶,請確認您已選取所需的訂用帳戶。If you have multiple Azure subscriptions, verify that the subscription that you want is selected.
    資源群組Resource group 使用您用來建立快取的相同資源群組 (例如 TestResourceGroup )。Use the same resource group where you created the cache (for example, TestResourceGroup ). 資源群組可協助您以群組管理所有資源。The resource group helps you manage all resources as a group. 其後當您想要刪除應用程式時,請直接刪除該群組即可。Later, when you want to delete the app, you can just delete the group.
    App Service 計劃App Service plan 選取 [新增] ,然後建立名為 TestingPlan 的新 App Service 方案。Select New , and then create a new App Service plan named TestingPlan .
    使用您在建立快取時所使用的相同 位置Use the same Location you used when creating your cache.
    選擇 免費 大小。Choose Free for the size.
    App Service 方案會針對要搭配執行的 Web 應用程式定義一組計算資源。An App Service plan defines a set of compute resources for a web app to run with.

    App Service 對話方塊

  4. 在您設定 App Service 裝載設定後,請選取 [建立] 。After you configure the App Service hosting settings, select Create .

  5. 在 Visual Studio 中監視 [輸出] 視窗,以查看發佈狀態。Monitor the Output window in Visual Studio to see the publishing status. 應用程式發佈之後,系統會記錄應用程式的 URL:After the app has been published, the URL for the app is logged:

    發佈輸出

新增快取的應用程式設定Add the app setting for the cache

在發佈新的應用程式之後,請新增新的應用程式設定。After the new app has been published, add a new app setting. 這項設定會用來儲存快取連線資訊。This setting is used to store the cache connection information.

新增應用程式設定To add the app setting

  1. 在 Azure 入口網站頂端的搜尋列中輸入應用程式名稱,以尋找您所建立的新應用程式。Type the app name in the search bar at the top of the Azure portal to find the new app you created.

    尋找應用程式

  2. 新增名為 CacheConnection 的應用程式設定,以供應用程式用來連線至快取。Add a new app setting named CacheConnection for the app to use to connect to the cache. 在 CacheSecrets.config 檔案中使用針對 CacheConnection 所設定的相同值。Use the same value you configured for CacheConnection in your CacheSecrets.config file. 該值包含快取的主機名稱和存取金鑰。The value contains the cache host name and access key.

    新增應用程式設定

在 Azure 中執行應用程式Run the app in Azure

在您的瀏覽器中,移至應用程式的 URL。In your browser, go to the URL for the app. 該 URL 會顯示在 Visual Studio [輸出] 視窗中的發佈作業結果內。The URL appears in the results of the publishing operation in the Visual Studio output window. 此外,在 Azure 入口網站中,該 URL 也會提供於您建立的應用程式所屬的 [概觀] 頁面上。It's also provided in the Azure portal on the overview page of the app you created.

選取導覽列上的 [Azure Cache for Redis 測試] 以測試快取存取。Select Azure Cache for Redis Test on the navigation bar to test cache access.

簡單的測試已完成 Azure

清除資源Clean up resources

如果您準備繼續進行下一個教學課程,則可以保留在本快速入門中所建立的資源,並重複加以使用。If you're continuing to the next tutorial, you can keep the resources that you created in this quickstart and reuse them.

否則,如果您已完成快速入門範例應用程式,您可以將在此快速入門中建立的 Azure 資源刪除,以避免衍生費用。Otherwise, if you're finished with the quickstart sample application, you can delete the Azure resources that you created in this quickstart to avoid charges.

重要

刪除資源群組是無法回復的動作。Deleting a resource group is irreversible. 當您刪除資源群組時,其中包含的所有資源都將永久刪除。When you delete a resource group, all the resources in it are permanently deleted. 請確定您不會不小心刪除錯誤的資源群組或資源。Make sure that you do not accidentally delete the wrong resource group or resources. 如果您是在包含有需要保留之資源的現有資源群組內,建立用來裝載此範例的資源,則可以從每個資源各自的刀鋒視窗中個別刪除每個資源,而不必刪除正個資源群組。If you created the resources for hosting this sample inside an existing resource group that contains resources you want to keep, you can delete each resource individually from their respective blades instead of deleting the resource group.

刪除資源群組To delete a resource group

  1. 登入 Azure 入口網站,然後選取 [資源群組] 。Sign in to the Azure portal, and then select Resource groups .

  2. 在 [依名稱篩選...] 方塊中,並輸入您的資源群組名稱。In the Filter by name... box, type the name of your resource group. 本文的指示是使用名為 TestResources 的資源群組。The instructions for this article used a resource group named TestResources . 在資源群組的結果清單中,選取 ... ,然後選取 [刪除資源群組] 。On your resource group, in the results list, select ... , and then select Delete resource group .

    刪除

系統將會要求您確認是否刪除資源群組。You're asked to confirm the deletion of the resource group. 輸入您的資源群組名稱以進行確認,然後選取 [刪除] 。Type the name of your resource group to confirm, and then select Delete .

不久後,系統便會刪除該資源群組及其所有的資源。After a few moments, the resource group and all of its resources are deleted.

後續步驟Next steps

在下一個教學課程中,您會在更加真實的案例中使用 Azure Cache for Redis 來改善應用程式的效能。In the next tutorial, you use Azure Cache for Redis in a more realistic scenario to improve performance of an app. 您會將此應用程式更新為在 ASP.NET 和資料庫中使用另行快取模式來快取排行榜結果。You update this application to cache leaderboard results using the cache-aside pattern with ASP.NET and a database.