简体   繁体   English

是否可以将 Visual Studio 性能分析与服务结构一起使用?

[英]Is it possible to use visual studio performance profiling with service fabric?

Hopefully this is simple...希望这很简单...

I want to performance profile my service fabric cluster.我想对我的服务结构集群进行性能分析。

So far I: - Go to Start Diagnostics tools without debugging.到目前为止,我: - 在不进行调试的情况下转到“启动诊断工具”。 - Go through the wizard selecting my service fabric project as the startup project. - 通过向导选择我的服务结构项目作为启动项目。 - Then it asks which projects to include, so I include my service exe - Then I select instrumentation (I want method level timing) - 然后它询问要包含哪些项目,所以我包含了我的服务 exe - 然后我选择了检测(我想要方法级计时)

Then I hit start and immediately my exe crashes.然后我点击开始,我的 exe 立即崩溃。 I assume this is because visual studio is trying to run my "service" outside of the service fabric context as a standalone exe.我认为这是因为 Visual Studio 试图在服务结构上下文之外将我的“服务”作为独立的 exe 运行。

Not sure what to do about that though...不知道该怎么做,但...

The stack trace is:堆栈跟踪是:

DEBUG: Activating options调试:激活选项

Unhandled Exception: System.Fabric.FabricConnectionDeniedException: Not authorized to connect ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80071C43 at System.Fabric.Interop.NativeRuntime.FabricEndGetNodeContext(IFabricAsyncOperationContext context) at System.Fabric.FabricRuntime.NativeFabricRuntimeFactory.GetNodeContextEndWrapper(IFabricAsyncOperationContext context) at System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedCompletedSynchronously) --- End of inner exception stack trace --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ServiceFabric.Services.Runtime.RuntimeContext.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.C未处理的异常:System.Fabric.FabricConnectionDeniedException:未授权连接 ---> System.Runtime.InteropServices.COMException:来自 HRESULT 的异常:0x80071C43 在 System.Fabric.Interop.NativeRuntime.FabricEndGetNodeContext(IFabricAsyncOperationContext context) 在 SystemtimeFabric.FabricRun .NativeFabricRuntimeFactory.GetNodeContextEndWrapper(IFabricAsyncOperationContext context) 在 System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedCompletedSynchronously) --- 内部异常堆栈跟踪结束 --- 在 System.Runtime.CompilerServices.TaskNwaiter(ThrowForSuccessow)任务任务) 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在 Microsoft.ServiceFabric.Services.Runtime.RuntimeContext.d__3.MoveNext() --- 从上一个抛出异常的位置的堆栈跟踪结束 ---在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在 System.Runtime.C ompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ServiceFabric.Services.Runtime.ServiceRuntime.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() ompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ServiceFabric.Services.Runtime.ServiceRuntime.d__0.MoveNext() --- 从上一个抛出异常的位置结束堆栈跟踪---在 System.Runtime.CompilerServices.TaskAwaiter .ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

Thanks for the help in advance!提前感谢您的帮助!

What you're seeing is Visual Studio attempting to start your service host process on its own outside of the Service Fabric runtime.您看到的是 Visual Studio 尝试在 Service Fabric 运行时之外自行启动您的服务宿主进程。 Normally, when you run a service through Visual Studio, you deploy the application project, which goes through the process of registering and instantiating your services on your local Service Fabric cluster.通常,当您通过 Visual Studio 运行服务时,您会部署应用程序项目,该项目会经历在本地 Service Fabric 群集上注册和实例化服务的过程。

Instrumentation currently doesn't work out-of-the-box with Service Fabric projects for this reason.出于这个原因,检测当前不适用于 Service Fabric 项目。 We're looking at ways to make this possible in the future.我们正在寻找在未来实现这一目标的方法。

You can still do Sampling profiling, which allows you to attach the profiler to a running EXE.您仍然可以进行采样分析,这允许您将分析器附加到正在运行的 EXE。 In that case, you'd deploy your application normally first, then attach the profiler to your service EXEs.在这种情况下,您将首先正常部署您的应用程序,然后将分析器附加到您的服务 EXE。

See https://msdn.microsoft.com/en-us/library/dd255414.aspx?f=255&MSPPError=-2147217396https://msdn.microsoft.com/en-us/library/dd255414.aspx?f=255&MSPPError=-2147217396

  1. If needed, initialize the profiling environment variables with a variant of VSPerfClrEnv {/globalsamplegc | /globalsamplegclife}[/samplelineoff]如果需要,请使用VSPerfClrEnv {/globalsamplegc | /globalsamplegclife}[/samplelineoff]的变体VSPerfClrEnv {/globalsamplegc | /globalsamplegclife}[/samplelineoff]初始化分析环境变量VSPerfClrEnv {/globalsamplegc | /globalsamplegclife}[/samplelineoff] VSPerfClrEnv {/globalsamplegc | /globalsamplegclife}[/samplelineoff] , then reboot. VSPerfClrEnv {/globalsamplegc | /globalsamplegclife}[/samplelineoff] ,然后重新启动。
  2. Start the profiler to collect data with a variant of:启动探查器以收集具有以下变体的数据:

    VSPerfCmd /START:{COVERAGE|SAMPLE|CONCURRENCY|TRACE} /OUTPUT:file /ATTACH:(pid|name)[,(pid|name)]* [/USER:[domain\\]username]

The /USER:[domain\\]username is needed if the service or process is running under a different user account.如果服务或进程在不同的用户帐户下运行,则需要/USER:[domain\\]username

A .vspx or .vsp file extension is added to the /OUPUT:file specification. .vspx.vsp文件扩展名被添加到/OUPUT:file规范中。 Then you can open the .vspx or .vsp file in Visual Studio to view the profiling report.然后,您可以在 Visual Studio 中打开.vspx.vsp文件以查看分析报告。

Run VSPerfCmd /?运行VSPerfCmd /? for more explanation and to see the full list of profiling options.了解更多解释并查看完整的分析选项列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio性能分析优化 - Visual studio performance profiling optimization 在Visual Studio中运行网站与性能分析时的性能问题 - Performance issues when running site in visual studio vs profiling 如何在Visual Studio 2008“Pro”中执行性能分析 - How To Do Performance Profiling in Visual Studio 2008 “Pro” Visual Studio 性能分析 - 找不到类库符号 - Visual Studio Performance Profiling - Class library symbols could not be found Visual Studio性能分析WOW64错误 - Visual Studio performance profiling WOW64 error Service Fabric正在Visual Studio版本上删除ResourceOverrides - Service Fabric is Removing the ResourceOverrides on Visual Studio build 在 Visual Studio 中为 5 节点群集调试 Azure Service Fabric 应用程序 - Debugging Azure Service Fabric Application in Visual Studio for 5 node cluster 服务结构无法在 Visual Studio 中看到容器模板 - service fabric unable to see container template in Visual Studio 使用 NanoFramework 和 Visual Studio 分析 CPU? - Profiling CPU with NanoFramework and Visual Studio? 可以在带有jquery对话框的页面上使用Visual Studio 2010 Web性能测试吗? - Possible to use Visual Studio 2010 web performance test on page with jquery dialog?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM