简体   繁体   中英

getting error while uploading to azure media services from local system browser(using azure hosted website)

502 - Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.

This sounds like you are uploading the video asset that is large and it is timing out. You could try adjusting the settings for this in web.config:

<system.web>
    <httpRuntime maxRequestLength="102400" executionTimeout="3600" />

ref: http://www.telerik.com/blogs/upload-large-files-asp-net-radasyncupload

Also, verify you are uploading media correctly:

First create an IAsset:

IAsset inputAsset = _context.Assets.Create(assetName, assetCreationOptions.none);

Then create the asset file to be uploaded:

var assetFile = inputAsset.AssetFiles.Create(Path.GetFileName(filePath));

Create the access permisions and resource locator:

var policy = _context.AccessPolicies.Create(
                        assetName,
                        TimeSpan.FromDays(30),
                        AccessPermissions.Write | AccessPermissions.List);

var locator = _context.Locators.CreateLocator(LocatorType.Sas, inputAsset, policy);

And then finaly upload the file:

assetFile.Upload(singleFilePath);

ref: https://azure.microsoft.com/en-us/documentation/articles/media-services-dotnet-upload-files/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM