Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在Application Insights依赖项跟踪中,如何设置依赖项类型和结果代码?_C#_Azure_Azure Application Insights - Fatal编程技术网

C# 在Application Insights依赖项跟踪中,如何设置依赖项类型和结果代码?

C# 在Application Insights依赖项跟踪中,如何设置依赖项类型和结果代码?,c#,azure,azure-application-insights,C#,Azure,Azure Application Insights,使用Application Insights跟踪依赖项时,在Azure Portal中,这些事件包含未设置的属性依赖项类型和结果代码 如何跟踪依赖项以便设置属性依赖项类型和结果代码?请升级以使用最新的预发行版.NET SDK Nuget: 只是尝试了一个简单的例子: DependencyTelemetry dep = new DependencyTelemetry("DepName", "CommandName", DateTimeOffset.Now.AddSeconds(-1), Tim

使用Application Insights跟踪依赖项时,在Azure Portal中,这些事件包含未设置的属性依赖项类型和结果代码


如何跟踪依赖项以便设置属性依赖项类型和结果代码?

请升级以使用最新的预发行版.NET SDK Nuget:

只是尝试了一个简单的例子:

DependencyTelemetry dep = new DependencyTelemetry("DepName", "CommandName", DateTimeOffset.Now.AddSeconds(-1), TimeSpan.FromSeconds(1), true);
dep.DependencyTypeName = "MyTypeName";
dep.ResultCode = "200";

new TelemetryClient(new TelemetryConfiguration()
{
                InstrumentationKey = "ikey",
                TelemetryChannel = new InMemoryChannel()
 }).TrackDependency(dep);
我可以看到结果代码和类型: