Using ASP.NET Core In Phoesion Glow


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, we often need to use ASP.Net specific features or add a service already written in ASP.Net.

This article 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.

Using ASP.Net Core in Phoesion Glow

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

Using ASP.Net Core in Phoesion Glow


The AspFireflyService class

Notice that your ServiceMain class now derives from AspFireflyService instead of the basic FireflyService. The 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 :

  • http://localhost/MyCompany.Services.MyAspService/Test/Action1
  • http://localhost:16000/MyCompany.Services.MyAspService/Test/Action1

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)

Rerun the project and test using the following :

  • http://localhost/MyAspService/Test/Action1
  • http://localhost:16000/MyAspService/Test/Action1


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 fully utilize Phoesion Glow, including the out-of-the-box Mediator, API Gateway, Service-Bus, and Deployment/Managing/Monitoring capabilities.

For more information, you can dive into the documentation and sample repo.

Similar Articles