Phoesion Glow is a microservice development framework that offers a complete solution for creating, deploying, and managing your microservices. While Phoesion Glow offers a glow-native SDK for writing services, many times we need to use ASP.Net specific features or add a service that is already written in ASP.Net.
In this article, we will focus on creating Glow microservices using the ASP.Net framework.
Prerequisites / Preparation
For developing Phoesion Glow services we need a Windows machine with Visual Studio 2019/2022 and Phoesion Glow Blaze for Windows installed
Creating a new service
1. Create a new Solution
Create a new solution using Visual Studio with a Firefly ASP.NET Core Service Project project.
If you can't find the Firefly ASP.NET Core Service Project template, make sure you have Phoesion Glow Templates visual studio extension installed. If not you can get it from the Visual Studio Marketplace
2. Configure new Project
Name your new project and solution :
Project name : Foompany.Services.MyAspService Location : <Set your location> Solution name : Foompany.Services
Notice that your ServiceMain class now derives from
AspFireflyService instead of the basic
AspFireflyService class provides the necessary
IServer implementations that will hook into the ASP.Net framework and host the ASP.Net stack on top of Phoesion Glow. Think of it like a replacement of Kestrel, that instead of handling requests from sockets, it handles request from the Phoesion Glow framework.
Test your services
To test that your services are up and running open a browser and go to one of the following :
Changing the Service name (base path)
As a part of the Phoesion Glow project, your microservice MUST have a service name so the API Gateway system can route the request to the proper service. Like native Firefly Services this can be specified using the
[ServiceName("XXX")] attribute on the
ServiceMain.cs class. Change this to your desired name, for example just MyAspService (without the full assembly namespace that was added by the templates)
Run the project again and test using the following :
In this article, we demonstrated how easy it is to create a new ASP.NET microservice that can be deployed/hosted in our Phoesion Glow setup. We can now take full advantage of Phoesion Glow including the out-of-the-box Mediator, API Gateway, Service-Bus and Deployment/Managing/Monitoring capabilities.