Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Core RC2 in Service Fabric

I want to add a new .NET Core RC2 MVC application to an existing Service Fabric cluster, but I can't figure out how I should do this.

I've looked at several RC1 examples but that hasn't gotten me any further either. I understand you need to add an EntryPoint in your ServiceManifest.xml file. But in the RC1 example they point to the dnx.exe, which has been removed in RC2:

<EntryPoint>
     <ExeHost>
        <Program>approot\runtimes\dnx-clr-win-x64.1.0.0-rc1-update1\bin\dnx.exe</Program>
        <Arguments>--appbase approot\src\ChatWeb Microsoft.Dnx.ApplicationHost Microsoft.ServiceFabric.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener</Arguments>
        <WorkingFolder>CodePackage</WorkingFolder>
        <ConsoleRedirection FileRetentionCount="5" FileMaxSizeInKb="2048" />
     </ExeHost>
  </EntryPoint>

What EntryPoint should I use in the RC2 version of .NET Core?

Thanks!

like image 248
Johannes Heesterman Avatar asked May 21 '16 08:05

Johannes Heesterman


1 Answers

Check out this announcement:

Announcing ASP.NET Core RC2

As you can see, your ASP.NET Core application with RC2 becomes a console application.

That said, your entry point is your EXE that comes out from compilation of your ASP.NET Core console application.

So instead on relying on DNX to pickup Main method from your Startup.cs, you setup your toolchain in Program.cs and then just build an EXE that Service Fabric will use for Entry.

public class Program
{
    public static void Main(string[] args)
    {
        var host = new WebHostBuilder()
        .UseKestrel()
        .UseStartup<Startup>()
        .Build();
        host.Run();
    }
}

So your manifest would be something like this:

<EntryPoint>
     <ExeHost>
        <Program>YourApp.Exe</Program>
     </ExeHost>
 </EntryPoint>
like image 62
Admir Tuzović Avatar answered Sep 18 '22 08:09

Admir Tuzović