0

我正在尝试在 Windows Azure 媒体服务中找到与以下 S3 功能等效的功能:http ://www.bucketexplorer.com/documentation/amazon-s3--how-to-generate-url-for-amazon-s3- file.html#signedurl

我听说像这样的签名网址可以通过 S3 以及 CDN(如 Akamai)来实现。

2个问题。

1) 有人对如何在 WAMS 中实现签名 URL 有建议吗?

2) 有人知道 Azure 会在多大程度上与 Akamai 等其他 CDN 挂钩?

提前致谢。

4

1 回答 1

0

The Equivalent for this feature in Windows Azure is called Shared Access Signature. Media Services does support creating of SAS Origin Locators.

You can read the official documentation on how to create SAS Locator with .NET SDK.

Or you can check my project on GitHub and the Locators implementation in particular

A Code sample for generating SAS Locator for particular asset follows:

public string GetSasLocator(IAsset asset)
{
    // Create an 1-day readonly access policy. 
    IAccessPolicy streamingPolicy = this.MediaService.MediaContext.AccessPolicies.Create("Full Access Policy",
        TimeSpan.FromMinutes(20),
        AccessPermissions.List | AccessPermissions.Read | AccessPermissions.Read);

    // Create the origin locator. Set the start time as 5 minutes 
    // before the present so that the locator can be accessed immediately 
    // if there is clock skew between the client and server.
    ILocator sasLocator =
        (from l in this.MediaService.MediaContext.Locators
         where l.Type == LocatorType.Sas && l.AssetId.Equals(asset.Id)
         select l).FirstOrDefault();

    if (sasLocator != null && sasLocator.ExpirationDateTime < DateTime.UtcNow)
    {
        sasLocator.Delete();
        sasLocator = null;
    }

    if (sasLocator == null)
    {
        sasLocator = this.MediaService.MediaContext
            .Locators.CreateSasLocator(asset,
         streamingPolicy,
         DateTime.UtcNow.AddMinutes(-5));
    }
    // Create a full URL to the manifest file. Use this for playback
    // in streaming media clients. 
    string sasUrl = sasLocator.Path;

    // Display the full URL to the streaming manifest file.
    Console.WriteLine("URL to for blob upload: ");
    Console.WriteLine(sasUrl);

    return sasUrl;
}
于 2013-04-19T20:24:15.030 回答