您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

使用 Application Insights 探查实时 Azure Web 应用Profile live Azure web apps with Application Insights

Application Insights 的此功能已分别面向 Azure 应用服务和 Azure 计算资源提供正式版和预览版。This feature of Application Insights is generally available for Azure App Service and is in preview for Azure compute resources.

使用 Application Insights Profiler 确定实时 Web 应用程序中的每个方法花费了多长时间。Find out how much time is spent in each method in your live web application by using Application Insights Profiler. Application Insights 探查工具会显示应用提供的实时请求的详细探查信息,并突出显示占用最多时间的“热路径”。The Application Insights profiling tool shows detailed profiles of live requests that were served by your app, and highlights the hot path that uses the most time. 该探查器会自动选择具有不同响应时间的示例,然后使用各种技术将开销降到最低。The profiler automatically selects examples that have different response times, and then uses various techniques to minimize overhead.

该探查器目前适用于 Azure 应用服务上运行的、至少处于基本服务层的 ASP.NET Web 应用。The profiler currently works for ASP.NET web apps running on Azure App Service, in at least the Basic service tier.

启用探查器Enable the profiler

在代码中安装 Application InsightsInstall Application Insights in your code. 如果已安装,请确保使用的是最新版本。If it's already installed, make sure you have the latest version. 要检查最新版本,请在解决方案资源管理器中右键单击你的项目,然后选择“管理 NuGet 包” > “更新” > “更新所有包”。To check for the latest version, in Solution Explorer, right-click your project, and then select Manage NuGet packages > Updates > Update all packages. 然后重新部署应用。Then, redeploy your app.

使用的是 ASP.NET Core?获取详细信息Using ASP.NET Core? Get more information.

Azure 门户中,打开 Web 应用的 Application Insights 资源。In the Azure portal, open the Application Insights resource for your web app. 选择“性能” > “启用 Application Insights Profiler”。Select Performance > Enable Application Insights Profiler.

选择“启用探查器”横幅

另外,可以通过选择“配置”来查看状态,启用或禁用探查器。Alternatively, you can select Configure to view status and enable or disable the profiler.

在“性能”下,选择“配置”

配置有 Application Insights 的 Web 应用会在“配置”下列出。Web apps that are configured with Application Insights are listed under Configure. 如果需要,请根据说明安装探查器代理。Follow instructions to install the profiler agent, if needed. 如果尚无 Web 应用配置有 Application Insights,请选择“添加链接应用”。If no web apps have been configured with Application Insights, select Add Linked Apps.

若要控制链接的所有 Web 应用上的探查器,请在“配置”窗格中选择“启用探查器”或“禁用探查器”按钮。To control the profiler on all your linked web apps, in the Configure pane, select Enable Profiler or Disable Profiler.

“配置”窗格选项

与通过应用服务计划托管的 Web 应用不同,在 Azure 计算资源(例如:Azure 虚拟机、虚拟机规模集、Azure Service Fabric 或 Azure 云服务)中托管的应用程序不由 Azure 直接管理。Unlike web apps that are hosted through App Service plans, applications that are hosted in Azure compute resources (for example, Azure Virtual Machines, virtual machine scale sets, Azure Service Fabric, or Azure Cloud Services) are not directly managed by Azure. 在这种情况下,将没有任何要链接到的 Web 应用。In this case, there's no web app to link to. 请改为选择“启用探查器”按钮,而不是链接到应用。Instead of linking to an app, select the Enable Profiler button.

禁用探查器Disable the profiler

若要为单个应用服务实例停止或重新启动探查器,可在“Web 作业”下转到“应用服务资源”。To stop or restart the profiler for an individual App Service instance, under Web Jobs, go to the App Service resource. 若要删除探查器,请转到“扩展”。To delete the profiler, go to Extensions.

为 Web 作业禁用探查器

建议在所有 Web 应用上都启用探查器以便尽早发现任何性能问题。We recommend that you have the profiler enabled on all your web apps to discover any performance issues as early as possible.

如果使用 WebDeploy 将更改部署到 Web 应用程序,请确保排除 App_Data 文件夹,以防在部署期间将它删除。If you use WebDeploy to deploy changes to your web application, ensure that you exclude the App_Data folder from being deleted during deployment. 否则,下一次将 Web 应用程序部署到 Azure 时,会删除探查器扩展文件。Otherwise, the profiler extension's files are deleted the next time you deploy the web application to Azure.

将探查器与 Azure VM 和 Azure 计算资源一起使用(预览版)Using profiler with Azure VMs and Azure compute resources (preview)

在运行时为 Azure 应用服务启用 Application Insights 后,Application Insights Profiler 会自动可用。When you enable Application Insights for Azure App Service at runtime, Application Insights Profiler is automatically available. 如果已经为资源启用了 Application Insights,则可能需要通过使用“配置”向导更新到最新版本。If you have already enabled Application Insights for the resource, you might need to update to the latest version by using the Configure wizard.

获取有关用于 Azure 计算资源的探查器的预览版本的信息。Get information about a preview version of the profiler for Azure compute resources.

限制Limitations

默认数据保留期为 5 天。The default data retention is five days. 每天引入的最大数据量为 10 GB。The maximum data ingested per day is 10 GB.

使用探查器服务没有任何费用。There are no charges for using the profiler service. 要使用探查器服务,Web 应用必须至少托管在应用服务的基本层中。To use the profiler service, your web app must be hosted in at least the Basic tier of App Service.

开销和采样算法Overhead and sampling algorithm

在托管已启用探查器以捕获跟踪的应用程序的每个虚拟机上,探查器每小时随机运行 2 分钟。The profiler randomly runs two minutes every hour on each virtual machine that hosts the application that has profiler enabled for capturing traces. 当探查器运行时,它使服务器增加 5% 到 15% 的 CPU 开销。When the profiler is running, it adds between 5% and 15% CPU overhead to the server. 可用于托管应用程序的服务器越多,探查器对总体应用程序性能的影响越小。The more servers that are available for hosting the application, the less impact the profiler has on the overall application performance. 这是因为采样算法会使探查器在任何时候都只在 5% 的服务器上运行。This is because the sampling algorithm results in the profiler running on only 5% of servers at any time. 有更多服务器可用于响应 Web 请求,以抵消运行探查器所产生的服务器开销。More servers are available to serve web requests to offset the server overhead caused by running the profiler.

查看探查器数据View profiler data

转到“性能”窗格,然后向下滚动到操作列表。Go to the Performance pane, and then scroll down to the list of operations.

“Application Insights 性能”窗格示例列

操作表包含以下列:The operations table has these columns:

  • 计数:在“计数”窗格的时间范围内这些请求的数目。COUNT: The number of these requests in the time range of the COUNT pane.
  • 中值:应用响应请求所花费的平均时间。MEDIAN: The typical time your app takes to respond to a request. 在所有响应中,有一半的响应速度超过此值。Half of all responses were faster than this value.
  • 95%:95% 的响应速度超过此值。95TH PERCENTILE: 95% of responses were faster than this value. 如果此值与中值有显著差异,可能是应用存在间歇性的问题。If this value is substantially different from the median, there might be an intermittent problem with your app. (或者,原因可能出在某个设计功能上,如缓存。)(Or, it might be explained by a design feature, like caching.)
  • 探查器跟踪:一个图标,指示探查器已捕获此操作的堆栈跟踪。PROFILER TRACES: An icon indicates that the profiler has captured stack traces for this operation.

选择“视图”打开跟踪浏览器。Select View to open the trace explorer. 该浏览器显示探查器捕获的多个样本(已按响应时间分类)。The explorer shows several samples that the profiler has captured, classified by response time.

如果正在使用“预览性能”窗格,请转到此页的“执行操作”部分查看探查器跟踪。If you are using the Preview Performance pane, go to the Take Actions section of the page to view profiler traces. 选择“探查器跟踪”按钮。Select the Profiler Traces button.

“Application Insights 性能”窗格预览探查器跟踪

选择一个样本可以显示执行该请求所花费的时间的代码级细节。Select a sample to show a code-level breakdown of time spent executing the request.

Application Insights 跟踪浏览器

跟踪浏览器会显示以下信息:The trace explorer shows the following information:

  • 显示热路径:打开最大的叶节点,或者至少打开某个接近的节点。Show Hot Path: Opens the biggest leaf node, or at least something close. 大多数情况下,此节点与性能瓶颈相邻。In most cases, this node is adjacent to a performance bottleneck.
  • 标签:函数或事件的名称。Label: The name of the function or event. 树中显示了代码与所发生事件(如 SQL 和 HTTP 事件)的混合形式。The tree shows a mix of code and events that occurred (like SQL and HTTP events). 最前面的事件表示请求总持续时间。The top event represents the overall request duration.
  • 所用时间:从操作开始到操作结束之间的时间间隔。Elapsed: The time interval between the start of the operation and the end of the operation.
  • 时间:运行某个函数/事件的时间相对于运行其他函数的时间。When: When the function or event was running in relation to other functions.

如何读取性能数据How to read performance data

Microsoft 服务探查器结合使用采样方法和检测来分析应用程序的性能。The Microsoft service profiler uses a combination of sampling methods and instrumentation to analyze the performance of your application. 当详细收集操作正在进行时,服务探查器将每隔一毫秒对每台计算机的 CPU 指令指针采样。When detailed collection is in progress, the service profiler samples the instruction pointer of each of the machine's CPU in every millisecond. 每个样本捕获当前正在执行的线程的完整调用堆栈。Each sample captures the complete call stack of the thread that currently is executing. 它从高级抽象化和低级抽象化两个角度,提供有关线程当前行为的有用详细信息。It gives detailed and useful information about what that thread was doing, both at a high level and at a low level of abstraction. 服务探查器还会收集其他事件(包括上下文切换事件、任务并行库 (TPL) 事件和线程池事件),以跟踪活动相关性和因果关系。The service profiler also collects other events to track activity correlation and causality, including context switching events, Task Parallel Library (TPL) events, and thread pool events.

时间线视图中显示的调用堆栈是采样和检测的结果。The call stack that's shown in the timeline view is the result of the sampling and instrumentation. 由于每个样本会捕获线程的整个调用堆栈,因此包含 Microsoft .NET Framework 中的代码,以及引用的其他框架。Because each sample captures the complete call stack of the thread, it includes code from the Microsoft .NET Framework, and from other frameworks that you reference.

对象分配(clr!JIT_New 或 clr!JIT_Newarr1)Object allocation (clr!JIT_New or clr!JIT_Newarr1)

clr!JIT_New 和 clr!JIT_Newarr1 是 .NET Framework 中的 helper 函数,用于分配托管堆中的内存。clr!JIT_New and clr!JIT_Newarr1 are helper functions in the .NET Framework that allocate memory from a managed heap. 分配对象时,将调用 clr!JIT_New。clr!JIT_New is invoked when an object is allocated. 分配对象数组时,将调用 clr!JIT_Newarr1。clr!JIT_Newarr1 is invoked when an object array is allocated. 这两个函数通常速度很快,花费的时间相对较短。These two functions typically are very fast, and take relatively small amounts of time. 如果发现时间线中的 clr!JIT_New 或 clr!JIT_Newarr1 花费了很长时间,则可能表示代码分配了很多对象,从而消耗了大量的内存。If you see clr!JIT_New or clr!JIT_Newarr1 take a substantial amount of time in your timeline, it's an indication that the code might be allocating many objects and consuming significant amounts of memory.

加载代码 (clr!ThePreStub)Loading code (clr!ThePreStub)

clr!ThePreStub 是 .NET Framework 中的 helper 函数,用于准备首次执行的代码。clr!ThePreStub is a helper function in the .NET Framework that prepares the code to execute for the first time. 这通常包括但不限于实时 (JIT) 编译。This typically includes, but is not limited to, just-in-time (JIT) compilation. 对于每个 C# 方法,在进程的生存期内,最多只应调用 clr!ThePreStub 一次。For each C# method, clr!ThePreStub should be invoked at most once during the lifetime of a process.

如果 clr!ThePreStub 针对某个请求花费了很长时间,则表示这是第一个执行该方法的请求。If clr!ThePreStub takes a substantial amount of time for a request, this indicates that the request is the first one that executes that method. .NET Framework 运行时加载该方法的时间非常重要。The time for the .NET Framework runtime to load that method is significant. 可以考虑在用户访问该代码部分之前使用执行该代码部分的预热进程,或者考虑在程序集中运行本机映像生成器 (ngen.exe)。You might consider using a warmup process that executes that portion of the code before your users access it, or consider running Native Image Generator (ngen.exe) on your assemblies.

锁争用(clr!JITutil_MonContention 或 clr!JITutil_MonEnterWorker)Lock contention (clr!JITutil_MonContention or clr!JITutil_MonEnterWorker)

clr!JITutil_MonContention 或 clr!JITutil_MonEnterWorker 指示当前线程正在等待释放锁。clr!JITutil_MonContention or clr!JITutil_MonEnterWorker indicates that the current thread is waiting for a lock to be released. 执行 C# LOCK 语句、调用 Monitor.Enter 方法或者结合 MethodImplOptions.Synchronized 属性调用某个方法时,通常会显示这种状态。This typically shows up when executing a C# LOCK statement, when invoking the Monitor.Enter method, or when invoking a method with the MethodImplOptions.Synchronized attribute. 如果线程 A 获取了某个锁,而线程 B 在线程 A 释放该锁之前尝试获取同一个锁,此时通常会发生锁争用。Lock contention typically occurs when thread A acquires a lock, and thread B tries to acquire the same lock before thread A releases it.

加载代码 ([COLD])Loading code ([COLD])

如果方法名称包含 [COLD](例如 mscorlib.ni![COLD]System.Reflection.CustomAttribute.IsDefined),则表示 .NET Framework 运行时首次执行的代码未经过按配置优化功能的优化。If the method name contains [COLD], such as mscorlib.ni![COLD]System.Reflection.CustomAttribute.IsDefined, the .NET Framework runtime is executing code for the first time that is not optimized by profile-guided optimization. 对于每个方法,在进程的生存期内,这种状态最多只应出现一次。For each method, it should show up at most once during the lifetime of the process.

如果针对某个请求加载代码花费的时间很长,这表示这是第一个执行该方法的未优化部分的请求。If loading code takes a substantial amount of time for a request, this indicates that the request is the first one to execute the unoptimized portion of the method. 请考虑在用户访问该代码部分之前使用执行该代码部分的预热进程。Consider using a warmup process that executes that portion of the code before your users access it.

发送 HTTP 请求Send HTTP request

HttpClient.Send 等方法指示代码正在等待某个 HTTP 请求完成。Methods like HttpClient.Send indicate that the code is waiting for an HTTP request to be completed.

数据库操作Database operation

SqlCommand.Execute 等方法指示代码正在等待某个数据库操作完成。Methods like SqlCommand.Execute indicate that the code is waiting for a database operation to finish.

等待 (AWAIT_TIME)Waiting (AWAIT_TIME)

AWAIT_TIME 指示代码正在等待另一个任务完成。AWAIT_TIME indicates that the code is waiting for another task to finish. 这种情况通常发生在 C# AWAIT 语句上。This typically happens with the C# AWAIT statement. 当代码执行 C# AWAIT 时,线程会回退并将控制权返回给线程池,此时,不会有任何阻塞的线程等待 AWAIT 完成。When the code does a C# AWAIT, the thread unwinds and returns control to the thread pool, and there is no thread that is blocked waiting for the AWAIT to finish. 但是,从逻辑上讲,执行 AWAIT 的线程会被“阻塞”并等待该操作完成。However, logically, the thread that did the AWAIT is "blocked," and is waiting for the operation to finish. AWAIT_TIME 语句指示等待任务完成的阻塞时间。The AWAIT_TIME statement indicates the blocked time waiting for the task to finish.

阻塞时间Blocked time

BLOCKED_TIME 指示代码正在等待另一个资源变为可用。BLOCKED_TIME indicates that the code is waiting for another resource to be available. 例如,它可能会等待同步对象或线程变为可用,或等待请求完成。For example, it might be waiting for a synchronization object, for a thread to be available, or for a request to finish.

CPU 时间CPU time

CPU 正忙于执行指令。The CPU is busy executing the instructions.

磁盘时间Disk time

应用程序正在执行磁盘操作。The application is performing disk operations.

网络时间Network time

应用程序正在执行网络操作。The application is performing network operations.

“时间”列When column

“时间”列是针对节点收集的非独占样本在各个时间发生的变化的可视化效果。The When column is a visualization of how the INCLUSIVE samples collected for a node vary over time. 请求的总范围划分成 32 个时间存储桶。The total range of the request is divided into 32 time buckets. 该节点的非独占样本会在这 32 个存储桶中累积。The inclusive samples for that node are accumulated in those 32 buckets. 每个存储桶用一个条形表示。Each bucket is represented as a bar. 条形的高度表示缩放后的值。The height of the bar represents a scaled value. 对于带有 CPU_TIME 或 BLOCKED_TIME 标记的节点,或者资源(CPU、磁盘、线程)的消耗存在某种明显关系时,条形表示在该桶的时间段内消耗了其中的某个资源。For nodes marked CPU_TIME or BLOCKED_TIME, or where there is an obvious relationship of consuming a resource (CPU, disk, thread), the bar represents consuming one of those resources for the period of time of that bucket. 如果消耗多个资源,这些指标的值可能大于 100%。For these metrics, it's possible to get a value of greater than 100% by consuming multiple resources. 例如,如果在某个时间间隔内平均使用两个 CPU,则指标值为 200%。For example, if on average you use two CPUs during an interval, you get 200%.

故障排除Troubleshooting

活动分析会话太多Too many active profiling sessions

目前,最多可以对同一服务计划上运行的 4 个 Azure Web 应用和部署槽启用探查器。Currently, you can enable profiler on a maximum of four Azure web apps and deployment slots that are running in the same service plan. 如果探查器 Web 作业报告活动分析会话太多,请将一些 Web 应用移到不同的服务计划。If the profiler web job is reporting too many active profiling sessions, move some web apps to a different service plan.

如何确定 Application Insights Profiler 是否正在运行?How do I determine whether Application Insights Profiler is running?

探查器在 Web 应用中以连续 Web 作业的形式运行。The profiler runs as a continuous web job in the web app. 可以在 Azure 门户中打开 Web 应用资源。You can open the web app resource in the Azure portal. 在“WebJobs”窗格中,查看 ApplicationInsightsProfiler 的状态。In the WebJobs pane, check the status of ApplicationInsightsProfiler. 如果探查器未运行,请打开“日志”获取详细信息。If it isn't running, open Logs to get more information.

为何即使运行了探查器,也找不到任何堆栈示例?Why can't I find any stack examples, even though the profiler is running?

下面是可以检查的几个因素:Here are a few things that you can check:

  • 确保 Web 应用服务计划属于基本层或更高层。Make sure that your web app service plan is Basic tier or above.
  • 确保 Web 应用中已启用 Application Insights SDK 2.2 Beta 或更高版本。Make sure that your web app has Application Insights SDK 2.2 Beta or later enabled.
  • 确保配置 Web 应用中的 APPINSIGHTS_INSTRUMENTATIONKEY 设置所采用的检测密钥与 Application Insights SDK 使用的检测密钥相同。Make sure that your web app has the APPINSIGHTS_INSTRUMENTATIONKEY setting configured with the same instrumentation key that's used by the Application Insights SDK.
  • 确保 Web 应用在 .NET Framework 4.6 上运行。Make sure that your web app is running on .NET Framework 4.6.
  • 如果 Web 应用是一个 ASP.NET Core 应用程序,请检查所需的依赖项If your web app is an ASP.NET Core application, check the required dependencies.

启动探查器后,将有短暂的一段预热时间,在此期间,探查器会活跃地收集多种性能跟踪。After the profiler is started, there is a short warmup period during which the profiler actively collects several performance traces. 此后,探查器将每隔一小时收集性能跟踪两分钟。After that, the profiler collects performance traces for two minutes in every hour.

使用 Azure 服务事件探查器时出现问题,I was using Azure Service Profiler. 原因是什么?What happened to it?

启用 Application Insights Profiler 时,会禁用 Azure 服务探查器代理。When you enable Application Insights Profiler, the Azure Service Profiler agent is disabled.

并行线程的重复计算Double counting in parallel threads

在某些情况下,堆栈查看器中的总时间指标大于请求的持续时间。In some cases, the total time metric in the stack viewer is more than the duration of the request.

如果存在与请求关联的两个或更多个线程并且它们并行运行,则可能会发生这种情况。This might occur when there are two or more threads associated with a request, and they are operating in parallel. 在这种情况下,总线程时间就会超过已用时间。In that case, the total thread time is more than the elapsed time. 一个线程可能会等待另一个线程完成。One thread might be waiting on the other to be completed. 查看器会尝试检测此数据并省略不相关的等待时间,但是,它会倾向于显示过多信息,而不是省略关键信息。The viewer tries to detect this and omits the uninteresting wait, but it errs on the side of showing too much rather than omitting what might be critical information.

如果看到跟踪中出现并行线程,请确定哪些线程处于等待状态,以便可以确定请求的关键路径。When you see parallel threads in your traces, determine which threads are waiting so you can determine the critical path for the request. 在大多数情况下,快速进入等待状态的线程只是在等待其他线程完成。In most cases, the thread that quickly goes into a wait state is simply waiting on the other threads. 请专注于其他线程,忽略等待中线程花费的时间。Concentrate on the other threads and ignore the time in the waiting threads.

无探查数据No profiling data

下面是可以检查的几个因素:Here are a few things that you can check:

  • 如果要查看的数据的期限超过了好几周,请尝试限制时间筛选器并重试。If the data you are trying to view is older than a couple of weeks, try limiting your time filter and try again.
  • 检查代理或防火墙是否未阻止对 https://gateway.azureserviceprofiler.net 的访问。Check that proxies or a firewall have not blocked access to https://gateway.azureserviceprofiler.net.
  • 检查在应用中使用的 Application Insights 检测密钥是否与启用探查的 Application Insights 资源使用的检测密钥相同。Check that the Application Insights instrumentation key you are using in your app is the same as the Application Insights resource that you used to enabled profiling. 密钥通常在 ApplicationInsights.config 中,但也可能在 web.config 或 app.config 文件中。The key usually is in ApplicationInsights.config, but also might be located in the web.config or app.config files.

探查查看器中的错误报告Error report in the profiling viewer

在门户中提交支持票证。Submit a support ticket in the portal. 请务必包含错误消息中的相关性 ID。Be sure to include the correlation ID from the error message.

部署错误:目录不为空“D:\home\site\wwwroot\App_Data\jobs”Deployment error: Directory Not Empty 'D:\home\site\wwwroot\App_Data\jobs'

如果在已启用探查器的情况下将 Web 应用重新部署到应用服务资源,可能会看到如下消息:If you are redeploying your web app to an App Service resource with the profiler enabled, you might see a message that looks like the following:

目录不为空“D:\home\site\wwwroot\App_Data\jobs”Directory Not Empty 'D:\home\site\wwwroot\App_Data\jobs'

如果通过脚本或通过 Visual Studio Team Services 部署管道运行 Web 部署,则会发生此错误。This error occurs if you run Web Deploy from scripts or from Visual Studio Team Services Deployment Pipeline. 解决方法是将以下附加部署参数添加到 Web 部署任务:The solution is to add the following additional deployment parameters to the Web Deploy task:

-skip:Directory='.*\\App_Data\\jobs\\continuous\\ApplicationInsightsProfiler.*' -skip:skipAction=Delete,objectname='dirPath',absolutepath='.*\\App_Data\\jobs\\continuous$' -skip:skipAction=Delete,objectname='dirPath',absolutepath='.*\\App_Data\\jobs$'  -skip:skipAction=Delete,objectname='dirPath',absolutepath='.*\\App_Data$'

这些参数将删除 Application Insights Profiler 所用的文件夹,并取消阻止重新部署进程。These parameters delete the folder that's used by Application Insights Profiler and unblock the redeploy process. 它们不会影响当前运行的探查器实例。They don't affect the profiler instance that's currently running.

手动安装Manual installation

配置探查器时,将对 Web 应用的设置进行更新。When you configure the profiler, updates are made to the web app's settings. 如果你的环境有此要求,则可以手动应用更新。You can apply the updates manually if your environment requires it. 例如在适用于 PowerApps 的应用服务环境中运行应用程序的情况。For example, if your application runs in App Service Environment for PowerApps.

  1. 在 Web 应用控制窗格中,打开“设置”。In the web app control pane, open Settings.
  2. 将“.Net Framework 版本”设置为“v4.6”。Set .Net Framework version to v4.6.
  3. 将“Always On”设置为“打开”。Set Always On to On.
  4. 添加应用设置“APPINSIGHTS_INSTRUMENTATIONKEY”,将值设置为 SDK 使用的同一检测密钥。Add the APPINSIGHTS_INSTRUMENTATIONKEY app setting and set the value to the same instrumentation key that's used by the SDK.
  5. 打开“高级工具”。Open Advanced Tools.
  6. 选择“转到”打开 Kudu 网站。Select Go to open the Kudu website.
  7. 在 Kudu 网站上,选择“站点扩展”。On the Kudu website, select Site extensions.
  8. 从 Azure Web 应用库中安装“Application Insights”。Install Application Insights from the Azure Web Apps Gallery.
  9. 重新启动 Web 应用。Restart the web app.

ASP.NET Core 支持ASP.NET Core support

ASP.NET Core 应用程序需要安装 Microsoft.ApplicationInsights.AspNetCore NuGet 包 2.1.0-beta6 或更高版本才能使用探查器。An ASP.NET Core application needs to install the Microsoft.ApplicationInsights.AspNetCore NuGet package 2.1.0-beta6 or later to work with the profiler. 自 2017 年 6 月 27 日起,以前的版本将不再受支持。As of June 27, 2017, we don't support earlier versions.

后续步骤Next steps