適用於 .NET 的 Azure CDN 程式庫

概觀

Azure 內容傳遞網路 (CDN) 會在策略性放置的位置上快取靜態 Web 內容,以提供最大輸送量來將內容傳遞給使用者。 CDN 為開發人員提供一套全球解決方案,以在全球實體節點上快取內容來傳遞高頻寬內容。

若要深入了解 Azure CDN,請參閱 Azure 內容傳遞網路的概觀

管理程式庫

您可以使用適用於 .NET 的 Azure CDN 程式庫,自動建立和管理 CDN 設定檔與端點。

直接從 Visual Studio 套件管理員主控台安裝 NuGet 套件,或使用 .NET Core CLI

Visual Studio 套件管理員

Install-Package Microsoft.Azure.Management.Cdn.Fluent
dotnet add package Microsoft.Azure.Management.Cdn.Fluent

範例

此範例會使用指向 www.contoso.com 的新端點來建立新的 CDN 設定檔。

/* Include these "using" directives.
using Microsoft.Azure.Management.Cdn.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent.Core;
*/

ICdnProfile profileDefinition = azure.CdnProfiles.Define("CdnProfileName")
    .WithRegion(Region.USCentral)
    .WithExistingResourceGroup("ResourceGroupName")
    .WithStandardVerizonSku()
    .WithNewEndpoint("www.contoso.com")
    .Create();

範例