Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see if running under service fabric

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);
}
like image 833
user1496062 Avatar asked Sep 30 '16 00:09

user1496062


People also ask

Is service Fabric going away?

Today, we are announcing the retirement of Azure Service Fabric Mesh. We will continue to support existing deployments until April 28th, 2021, however new deployments will no longer be permitted through the Service Fabric Mesh API.

Where is the service Fabric log?

Access the logs of a running container In a web browser, open Service Fabric Explorer from the cluster's management endpoint by navigating to http://mycluster.region.cloudapp.azure.com:19080/Explorer . Container logs are located on the cluster node that the container service instance is running on.


1 Answers

Check Service Fabric Environment Variables:

var sfAppName = Environment.GetEnvironmentVariable("Fabric_ApplicationName");
var isSf = sfAppName != null;

Source: from @mkosieradzki GitHub Issue

like image 86
spottedmahn Avatar answered Oct 19 '22 14:10

spottedmahn