I have Service Fabric and web service in it. If I run the Service Fabric locally, from Visual Studio, I can debug my service, and it is very convenient.
However, it takes a lot of time to deploy my code changes to local fabric. I am sure there should be an option to start my service separately from Service Fabric. It seems I need to update my method 'Main', so that it starts the service differently in case of dev environment.
Any ideas what exactly should be changed?
Oleg Karasik's response helped to shape the solution. I do not use any Service Fabric specific features yet, so it worked out.
The only code I needed to modify was the class Program:
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.ServiceFabric.Services.Runtime;
using System;
using System.Diagnostics;
using System.Threading;
namespace MyNameSpace
{
internal static class Program
{
private static void Main()
{
if (string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("Fabric_ApplicationName")))
{
StartInIISExpress();
}
else
{
StartInServiceFabric();
}
}
private static void StartInIISExpress()
{
WebHost.CreateDefaultBuilder()
.UseStartup<Startup>()
.Build().Run();
}
private static void StartInServiceFabric()
{
< original code of the method Main >
}
}
}