我正在开发 DOT 5.0 版本。 (核心 MVC 应用程序)。
在 Azure 中上传文件时(编码期间)遇到错误。
Asset outputAsset = await CreateOutputAssetAsync(client, config.ResourceGroup, config.AccountName,
outputAssetName, uploadedAsset.Description);
private static async Task<Asset> CreateOutputAssetAsync(IAzureMediaServicesClient client,
string resourceGroupName, string accountName, string assetName, string assetDescription)
{
// Check if an Asset already exists
Asset outputAsset = await client.Assets.GetAsync(resourceGroupName, accountName, assetName);
string outputAssetName = assetName;
Asset asset = new Asset()
{
Description = "Encoded-" + assetDescription,
StorageAccountName = "MyStoarestorage"
};
return await client.Assets.CreateOrUpdateAsync(resourceGroupName, accountName, outputAssetName, asset);
}
await the client.Assets.GetAsync 行失败。 我是否遗漏了任何包裹? 按照以下 URL 进行安装。 (https://learn.microsoft.com/en-us/azure/media-services/latest/configure-connect-dotnet-howto)。
请提出建议。 注意:- 相同的代码在我的桌面应用程序中运行良好,并使用 Azure 中的编码上传视频。但是何时应用相同的代码 .NET 5.0 CORE MVC 应用程序有些不工作
最佳答案
在 Microsoft.Azure.Manangement.Media
版本 5.0 中,我们对尝试检索不存在 Assets 的 get 函数进行了重大更改 ( source ):
- All calls returning 404 Not found raises an ErrorResponseException instead of returning null. This change was make to be consistent with other Azure SDKs.
您能否检查一下您的桌面应用程序中是否使用了旧版本的库?这可能是行为差异的原因。
关于azure - 操作返回无效状态代码 'NotFound' DotNet Core,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71063457/