0

这是我到目前为止所尝试的:

1) 使用 Kudu 将控制台工具上传到应用程序并运行它们。好吧,这是不可能的,因为不允许写入注册表。

2) 使用 Kudu 上传 RemoteAgent 并运行它。我得到: No DNS entries exist for host xxx. No such host is known.从 dotTrace UI 连接到 Kudu 控制台中打印的 URL 时。App 服务只能监听 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;
4

1 回答 1

0

目前不可能。此处创建的问题:https ://youtrack.jetbrains.com/issue/PROF-921

于 2019-11-08T21:26:41.640 回答