您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

用于 .NET 的 Azure CDN 库Azure CDN libraries for .NET

概述Overview

Azure 内容分发网络 (CDN) 将静态 Web 内容缓存在按特定策略布置好的位置,以便提供最大的吞吐量,方便将内容分发给用户。The Azure Content Delivery Network (CDN) caches static web content at strategically placed locations to provide maximum throughput for delivering content to users. CDN 将内容缓存在世界各地的物理节点,从而为开发人员提供交付高带宽内容的全球解决方案。The CDN offers developers a global solution for delivering high-bandwidth content by caching the content at physical nodes across the world.

若要详细了解 Azure CDN,请参阅 Azure 内容分发网络概述To learn more about Azure CDN, see Overview of the Azure Content Delivery Network.

管理库Management library

可以使用用于 .NET 的 Azure CDN 库来自动创建和管理 CDN 配置文件与终结点。You can use the Azure CDN Library for .NET to automate creation and management of CDN profiles and endpoints.

直接从 Visual Studio 包管理器控制台或使用 .NET Core CLI 安装 NuGet 包Install the NuGet package directly from the Visual Studio Package Manager console or with the .NET Core CLI.

Visual Studio 包管理器Visual Studio Package Manager

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

示例Example

此示例创建一个新的 CDN 配置文件,其中包含指向 www.contoso.com 的新终结点。This example creates a new CDN profile with a new endpoint pointed to www.contoso.com.

/* 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();

示例Samples