如何查看是否在Service Fabric下运行 [英] How to see if running under service fabric

查看:51
本文介绍了如何查看是否在Service Fabric下运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我会在Visual Studio之外本地运行项目,是否有更好的方法来检测我是否由SF托管,而不是例外.我可以看到路径或入口组件,但必须有更好的方法.

I sometimes run projects locally out of visual studio is there a better way to detect if I'm hosted by SF rather than the exception. I can see possibly the path or entry assembly but there must be a better way.

try
{
    ServiceRuntime.RegisterServiceAsync("FisConfigUIType",
        context = > new WebHost < Startup > (context, loggerFactory, "ServiceEndpoint", Startup.serviceName)).GetAwaiter().GetResult();
    Thread.Sleep(Timeout.Infinite);
}
catch (FabricException sfEx)
{
    RunLocal(args, loggerFactory);
}

推荐答案

检查

来源:来自@mkosieradzki GitHub问题

Source: from @mkosieradzki GitHub Issue

这篇关于如何查看是否在Service Fabric下运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆