如何使用Visual Studio 2017对ASP.NET IIS Web应用程序进行性能配置?

时间:2022-06-24 05:39:14

I have an ASP.NET web application, and certain operations execute 6 times slower in the full fledged IIS 8.5 on the server versus in Visual Studio's IIS Express.

我有一个ASP.NET Web应用程序,某些操作在服务器上完全成熟的IIS 8.5中执行速度比在Visual Studio的IIS Express中慢6倍。

If I'd try to attach for just debugging I properly see w3wp.exe: 如何使用Visual Studio 2017对ASP.NET IIS Web应用程序进行性能配置?

如果我尝试附加只是调试我正确看到w3wp.exe:

I cannot see w3wp.exe in the Profiler's Attach dialog. 如何使用Visual Studio 2017对ASP.NET IIS Web应用程序进行性能配置?

我在Profiler的Attach对话框中看不到w3wp.exe。

I'm running VS 2017 with Administrator privileges. This is not a remote debugging scenario, both the full-fledged IIS and the debug tools are on the same server (a Windows Server 2012 R2 Essentials if that matters). I'm using Visual Studio 2017 Community Edition.

我正在使用管理员权限运行VS 2017。这不是一个远程调试方案,完整的IIS和调试工具都在同一台服务器上(如果重要的话,则是Windows Server 2012 R2 Essentials)。我正在使用Visual Studio 2017社区版。

How can I debug my application in the IIS so I can figure out why it's 6 times slower there? It stuns me because usually it's the other way around: debug and profile versions are much slower than release ones.

如何在IIS中调试我的应用程序,以便我可以找出为什么它的速度慢6倍?它让我感到震惊,因为通常它是另一种方式:调试和配置文件版本比发布版本慢得多。

Our server BTW is very memory limited. There are two developers working simultaneously and the 16GB physical memory (not upgradeable unfortunately) is topped easily. So I guess the regular IIS is in a memory squeeze by all the developer tools, SQL Server, etc. That might be a reason for slowness, but I don't want a guessing game, I'd like to see a profile session. Profiling VS's IIS Express was super easy BTW. If I see it correctly Visual Studio 2015 didn't even offer the profiling of a Running Process.

我们的服务器BTW非常受内存限制。有两个开发人员同时工作,16GB物理内存(不幸的是不可升级)很容易上手。因此,我认为常规IIS在所有开发人员工具,SQL Server等的内存挤压中。这可能是一个缓慢的原因,但我不想要一个猜谜游戏,我想看一个配置文件会话。分析VS的IIS Express非常容易BTW。如果我正确地看到它,Visual Studio 2015甚至不提供正在运行的进程的分析。


Rob was quite terse. First, you need to start Visual Studio in Administrator mode. Besides selecting ASP.NET as Analysis Target in the beginning, once the Profiling Wizard comes up on Page 2 you have to yet again select "An ASP.NET application" instead of your available project, otherwise Visual Studio just fires up a server. After that on Page 3 of 4 I specify the web URL of the application running by my local (non developer) IIS server (http://localhost:8000). Here you have to restart VS in Admin mode if you haven't done so. Then the Performance Output looks like if VS started another server:

罗布非常简洁。首先,您需要以管理员模式启动Visual Studio。除了在开始时选择ASP.NET作为分析目标之外,一旦分析向导出现在第2页上,您必须再次选择“一个ASP.NET应用程序”而不是您可用的项目,否则Visual Studio只会启动一个服务器。在第3页,共4页之后,我指定由我的本地(非开发人员)IIS服务器运行的应用程序的Web URL(http:// localhost:8000)。如果您还没有这样,则必须在管理员模式下重新启动VS.然后,如果VS启动另一台服务器,性能输出就像:

Preparing web server for profiling.
Profiling started.
Launching web server with profiling.
Profiling process ID 872 (w3wp).
Starting data collection. The output file is C:\Users\Csaba\Documents\MyProjectSrc\http_localhost_8000__170924.vspx
Profiling process ID 8416 (iexplore).
Attaching to process 8416.
Profiler stopping.
Stopping data collection.
Merging collection data. Please wait...
Data is saved in file C:\Users\Csaba\Documents\MyProjectSrc\http_localhost_8000__170924.vspx
Profiling finished.

After the data collection I saw some spurious errors int he Event log stating that the collection won't be successful. Seemingly it was able to collect data from 3rd party library. But I cannot guarantee it's 100% legit because I didn't examine it thoroughly this time.

在数据收集之后,我在事件日志中看到了一些虚假错误,表明集合不会成功。看起来它能够从第三方库中收集数据。但我不能保证它是100%合法的,因为这次我没有彻底检查它。

2 个解决方案

#1


3  

Choose "ASP.NET" instead of "Running Process..." when choosing the analysis target.

选择分析目标时,请选择“ASP.NET”而不是“正在运行过程...”。

#2


0  

I was running into some issues trying to run the Profiler (especially since windows home edition doesn't have the full IIS Set by default)

我在尝试运行Profiler时遇到了一些问题(特别是因为Windows Home Edition默认没有完整的IIS Set)

Since you are running Visual Studio 2017, It might be a lot easier to run the new diagnostics tool instead.

由于您运行的是Visual Studio 2017,因此运行新的诊断工具可能要容易得多。

The Diagnostics tool is located under

诊断工具位于

Debug->Windows->Show Diagnostic Tools

Debug-> Windows-> Show Diagnostic Tools

It provides the Cpu Analysis and Memory Analysis just like the analyzer does.
You can set a breakpoint and analyze a small section of the code as well.

它像分析仪一样提供Cpu分析和内存分析。您可以设置断点并分析代码的一小部分。

#1


3  

Choose "ASP.NET" instead of "Running Process..." when choosing the analysis target.

选择分析目标时,请选择“ASP.NET”而不是“正在运行过程...”。

#2


0  

I was running into some issues trying to run the Profiler (especially since windows home edition doesn't have the full IIS Set by default)

我在尝试运行Profiler时遇到了一些问题(特别是因为Windows Home Edition默认没有完整的IIS Set)

Since you are running Visual Studio 2017, It might be a lot easier to run the new diagnostics tool instead.

由于您运行的是Visual Studio 2017,因此运行新的诊断工具可能要容易得多。

The Diagnostics tool is located under

诊断工具位于

Debug->Windows->Show Diagnostic Tools

Debug-> Windows-> Show Diagnostic Tools

It provides the Cpu Analysis and Memory Analysis just like the analyzer does.
You can set a breakpoint and analyze a small section of the code as well.

它像分析仪一样提供Cpu分析和内存分析。您可以设置断点并分析代码的一小部分。