RESTful Services in Service Fabric

When creating a Service Fabric service with Visual Studio 2017, what is the difference between selecting the ASP.Net Core template vs Stateless Web API template. Figure 1 depicts the choices that you see from the New Service Fabric Service dialog:

Figure 1: Select a RESTful Service Framework

The difference between these two templates boils down to an ASP.NET Core vs. ASP.NET (non-Core) discussion.

The Stateless Web API template (shown below in Figure 2) generates a legacy (non-Core) Web API app 2.x application that contains Reliable Services hooks.

Figure 2: Web API 2.x Service

Note below in Figure 3 how the References (Dependencies) folder targets Web API-based 2.x libraries:

Figure 3: Web API 2.x Libraries

Whereas, the ASP.NET Core Service Fabric Template (shown below in Figure 4) generates an ASP.NET Core application that targets the full (not Core) .NET Framework, as shown below:

Figure 4: ASP.NET Core Service

Note below in Figure 5 how the Dependencies folder targets ASP.NET Core packages:

Figure 5: ASP.NET Core Libraries

There are numerous benefits for targeting Core, including performance, modularity and a lightweight footprint. .NET Core is the path forward for Service-based applications on the Microsoft platform and is exactly where you should be. By building new applications in legacy ASP.NET 4.x, you are incurring technical debt out-of-the-gate.

Presently, Service Fabric supports ASP.NET Core applications that target the full .NET Framework. Shortly, Microsoft will release the .NET Core 2.0 framework and Service Fabric will support it. The .NET Core framework is a targeted subset of the full .NET Framework that is cross-platform, supporting runtimes in Windows, Linux and Mac OS X.

To learn more about constructing Service Fabric application, reach out to me or visit the developer references site.

Leave a Reply

Your email address will not be published. Required fields are marked *