以下是我迄今为止尝试的内容:
1( 使用Kudu将控制台工具上传到应用程序并运行它们。这是不可能的,因为不允许写入注册表。
2( 使用Kudu上传RemoteAgent并运行它。我得到:连接到Kudu控制台中打印的URL时,dotTrace UI中的No DNS entries exist for host xxx. No such host is known.
。应用程序设备只能在端口80和443上侦听。
3( 使用dotTrace SDK和JetBrains.Profiler.Api看起来很有前景。不过,它不想在Azure上附加探查器(而不是在没有问题的本地(,使用此代码,它会遇到超时异常。
private void AttachProfiler(ProfilingType profilingType)
{
var folder = AppDomain.CurrentDomain.BaseDirectory;
FileList = GetListFile(folder);
CurrentProfilingType = profilingType.ToString();
SelfAttach.Attach(new SaveSnapshotProfilingConfig
{
ProfilingControlKind = ProfilingControlKind.Api,
SaveDir = Path.Combine(folder, "Temp") ,
RedistDir = Path.Combine(folder, "_JetBrains.Profiler.SelfSdk.2019.1.3"),
ProfilingType = profilingType,
ListFile = FileList
});
SleepUntilAttachedOrTimedOut();
}
private static string GetListFile(string folder)
{
return Path.Combine(folder, "snapshot_list.xml");
}
private void SleepUntilAttachedOrTimedOut()
{
var totalMilliseconds = 0;
while (!CheckProfilerAttached())
{
var intervalMilliseconds = 250;
Thread.Sleep(intervalMilliseconds);
totalMilliseconds += intervalMilliseconds;
if (totalMilliseconds >= 60000)
{
throw new TimeoutException("Could not attach profiler. Timeout.");
}
}
}
private bool CheckProfilerAttached() => SelfAttach.State == SelfApiState.Active;
当前不可能。此处创建的问题:https://youtrack.jetbrains.com/issue/PROF-921