This project was presented at ISSoft Insights 2018 IT Conference and demonstrates how conventional ASP.NET Core services can be transformed into Azure Service Fabric projects without loosing the ability for self-hosted execution.
The following source code contains:
- JokesApi/ - contains ASP.NET Core Web API service
- JokesWeb/ - contains ASP.NET Core MVC application
- JokesApp/ - contains Azure Service Fabric application project
- JokesApiContracts/ - contains shared models used for communication between JokesApi & JokesWeb
This project is created using Visual Studio 2017 (15.7) and requires Azure Service Fabric SDK (3.1.274) to run.
- Install .NET Core SDK (Windows). https://www.microsoft.com/net/download/windows
- Install Azure Service Fabric SDK (Windows). https://azure.microsoft.com/en-us/downloads
- Clone the master branch.
git clone https://github.com/coherentsolutionsinc/issoft-insights-2018-aspnetcore-to-fabric-service <path to the local folder> - Start Service Fabric Local Cluster (Five Node Cluster configuration)
- Build & Run.
build-and-run.ps1
The above listed step will:
- Get & Build the source code
- Run the application locally:
JokesWeb&JokesApi, createJokesDbin(localdb)\mssqllocaldb
Developer's comment:
If you are planning to use database different from
(localdb)\mssqllocaldbyou should modify the connection string insrc/JokesApi/Program.cs[65]
- Deploy the application to Service Fabric Local Cluster:
JokesWeb,JokesApi(English, Русский - Народные, Русский - Советские) - Navigate to Service Fabric Explorer / JokesApp / JokesWebService / (partition) / (any node) / ServiceEndpoint.
Developer's comment:
The self-hosted
JokesWebis http://localhost:54036The base path to
JokesWebServicein Service Fabric Explorer is http://localhost:19080/Explorer/index.html#/apptype/JokesAppType/app/JokesApp/service/JokesApp%252FJokesWebService
There are several .json files in mock-data/ directory that contains demo jokes. Feel free to use application Import functionality.
Developer's comment:
The application doesn't implement any kind of error handling logic and therefore has a high chance to crash.
- Service Fabric Explorer documentation. https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-visualizing-your-cluster
This project is owned by Coherent Solutions.
This project is licensed under the MIT License - see the LICENSE.md for details.