azure - 操作返回无效状态代码 'NotFound' DotNet Core

标签 azure .net-core azure-media-services aws-mediaservices

我正在开发 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/

相关文章:

c# - 调试 ASP.Net Core 2.1 时自动登录

ruby - 从 Azure 媒体服务中的 Assets 下载 Assets 文件

Azure 媒体服务状态已断开

Azure Blob存储,如何实现任何文档或文件的版本

c# - 模式匹配条件确保两个属性都不为空,但编译器会发出可能为空引用的警告。为什么?

azure - 管理员如何仅向特定用户授予应用程序注册的访问权限?

.net-core - 在使用身份服务器 4 .Net core 2.0 的客户端中未访问自定义声明

c# - 将现有 blob 使用到媒体服务 Assets (API v3)

azure - 无法对嵌套资源执行请求的操作。找不到父资源 '****.io'

sql-server - 批量删除数据 - Azure SQL Server