Azure Blob存储成功请求在Application Insights中显示为失败请求 [英] Azure Blob Storage successful requests show as failed requests in Application Insights

查看:58
本文介绍了Azure Blob存储成功请求在Application Insights中显示为失败请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下容器存在,因此返回失败的请求代码409

The following container exists and hence returns failed request code 409

var container = blobClient.GetContainerReference("my-container");
container.CreateIfNotExists();

在创建之前,我要进行检查以确保Blob引用不存在.这会返回带有bool的404响应代码.

I do a check to make sure the Blob reference doesn't exist before creating. This returns a 404 response code with a bool.

if(container.GetBlockBlobReference("this-file-could-exist").Exists()) {

在第一个示例中,我希望容器存在,在第二个示例中,我希望文件不存在.但是在两种情况下,我都会进行检查以确保结果.

In the first example I expect the container to exist, in the second expect the file not to exist. But in both cases I do a check to make sure.

代码都正常工作.问题在于,Application Insights会提醒我一堆失败的请求.尽管这些请求并不是真正失败,但实际上是成功的请求,因为那是我所期望的.

The code all works fine. The issue is that Application Insights alerts me to a heap of failed requests. Although these are not really failed requests there actually successful request because thats what I expect.

解决此问题的最佳方法是什么?我可以使Azure回报200成功,还是需要以某种方式在Application Insights中忽略这些问题.

Whats the best way to resolve this? Can I make azure return 200 success or do I need to ignore these in Application Insights somehow.

推荐答案

如果使用的是最新版本的Storage Client Library,则在执行 CloudBlobContainer.CreateIfNotExists()方法时,它实际上会执行创建操作,因此有时服务器响应将为409.

If you are using the latest version of the Storage Client Library, when you execute CloudBlobContainer.CreateIfNotExists() method, it actually execute create operation, so sometimes server response will be 409.

版本8.2.0的源代码

如果可能,您可以尝试将Storage Client Library版本降级到v7.2.1.

If possible, you can try to downgrade your Storage Client Library version to v7.2.1.

版本7.2.1的源代码

我在关于操作中执行以下代码,我可以在应用程序分析中找到 200 .结果代码.

I execute the following code in my About action, I can find the Result code in application insight is 200.

CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");

container.CreateIfNotExists();

这篇关于Azure Blob存储成功请求在Application Insights中显示为失败请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆