asp.net - 找不到 TraceConfigruation 参考(StackDriver ASP.Net 设置)
问题描述
我正在按照为 C# ASP.NET 设置 StackDriver Trace 的设置说明进行操作。在“配置客户端库”部分中,第 3 步:在Global.asax.cs
文件的WebApiApplication
类中添加以下 Init 代码块以初始化跟踪:
public override void Init()
{
string projectId = ConfigurationManager.AppSettings["projectId"];
// ...
base.Init();
TraceConfiguration traceConfig = TraceConfiguration
.Create(bufferOptions: BufferOptions.NoBuffer());
CloudTrace.Initialize(this, projectId, traceConfig);
}
TraceConfiguration 对象在步骤 2 中引用的任何一个客户端库中都不存在:
using Google.Cloud.Diagnostics.AspNet;
using Google.Cloud.Diagnostics.Common;
我找不到对该对象的任何引用,并且似乎没有内置到 .net 框架中。
解决方案
假设你正在使用这个:
https://cloud.google.com/trace/docs/setup/aspnet
如果我正确地遵循了这一点,我认为文档已经过时并且在一段时间前TraceConfiguration
被替换:TraceOptions
https://github.com/googleapis/google-cloud-dotnet/pull/1120
和:
TraceOptions
我会在 PR 上联系那些为这个库做出贡献的人,让我们看看我是否可以让他们帮助你——如果有必要——更正文档。
推荐阅读
- elasticsearch - 无法使用 curl 获取数据
- jquery - 如何同时显示和更改html内容
- java - 为什么 TestNG 优先级功能未按预期顺序运行
- groovy - JMeter - 如何从 jsr 223 断言中的多个 csv 文件获取断言数据
- shell - 在 shell 的同一行中设置和使用 docker alpine 中的环境变量
- vb.net - SqlBulkCopy 速度测试
- javascript - 当替换字符串中包含正则表达式时,为什么 str.replace() 行为异常?
- sql-server - 列名存在时出现错误“列名无效”
- javascript - 如何创建动态操作,以便根据用户的选择页面将或不会重定向
- excel - 从powershell中的excel文件中删除某些内容