72a606a776 | ||
---|---|---|
.. | ||
src | ||
.gitignore | ||
README.md | ||
Trackable.sln |
README.md
Bing Maps Fleet Tracker - Backend Services
The backend is divided into two main components:
- The Restful service with which the administration portal and mobile client communicate.
- An Azure function project that performs the trip detection.
Getting the sources
The sources of the Backend Services of Bing Maps Fleet Tracker are included in this repository. If you already downloaded the sources skip this step, otherwise clone the repository to a folder of your choosing and move to the Backend/
folder.
git clone https://github.com/Microsoft/Bing-Maps-Fleet-Tracker/
cd Bing-Maps-Fleet-Tracker/Backend
Prerequisites
- Windows environment
- Git
- Visual Studio 2022 including the capabilities:
- ASP.NET and web development (this includes the ASP.NET Core Runtime 6.0)
- Azure development
Build and Run
Rest Service
The Restful service is a .NET 6.0 web application and is compatibility with Entity Framework 6.4.
- Open solution
Backend/Trackable.sln
using Visual Studio 2022 - Select
Build
>Build Solution
from the menus. Your solution should build successfully. - Navigate to the
appsettings.json
file under theTrackable.Web
project. You will need to update some settings here to get your service up and running.- "ConnectionStrings: DefaultConnection": Should point to a Sql Server instance. By default this is set to localdb.
- "Authorization: ClientId, Client Secret": Should include the Application Id and Application Secret of a AAD V2 application. Note:- While adding app for bing map registration, make sure to add redirect url in format "http://localhost:<port_number>/signin-oidc". Where <port_number> is the port your application uses.
- "Authorization: OwnerEmail": Email of the owner of the deployment. On a fresh deployment, this is the only email that will be allowed to access the service.
- "Authorization: SecurityKey": A string of at least 128 bits that will be used in the signing and validation of the JWT tokens.
- "SubscriptionKeys: BingMapsKey": A valid Bing Maps Subscription Key for geocoding and frontend map controls. You can obtain a bing maps key by following this article.
* "Serving: ServeFrontend": Specifies whether the service should serve the administration portal from
wwwroot/dist
. If you set this to true, you must build the administration portal with the environmentself
and copy the artifacts fromFrontend/dist/
tobackend/Trackable.Web/wwwroot/dist/
. Command to build usingself environment
isng build --env=self
* "Serving: ServeSwagger": Specifies whether the service should serve a swagger endpoint. - "Serving: IsDebug": IsDebug turns off RequireHttps and turns on some diagnostic logging.
- (Optional) "SendGrid: ApiKey, FromEmailAddress": Specifies the SendGrid account used for sending Geofence email alerts. You can sign up for SendGrid keys from the SendGrid website.
- (Optional) "Instrumentation": Urls used to send telemetry Microsoft, see Telemetry collected by Bing Maps Fleet Tracker.
- (Optional) "Versioning": Used by the service to notify when a newer version is available in the deployment portal.
- Right click
Trackable.Web
project and choose optionSet as Startup Project
. - Run project using Visual Studio.
Azure Functions
- Open solution
Backend/Trackable.sln
using Visual Studio 2022 - Select
Build
>Build Solution
from the menus. Your solution should build successfully. - Navigate to the
appsettings.json
file under theTrackable.Func
project. You will need to update some settings here to get your service up and running.- "Values: DatabaseConnection": Should point to a Sql Server instance. By default this is set to localdb.
- "Values: BingMapsKey": A valid Bing Maps Subscription Key for geocoding and frontend map controls. You can obtain a bing maps key by following this article.
- "Values: AzureWebJobsStorage": Specifies the connection string to an Azure Storage Account which is used internally in the Azure Function.
- Right click
Trackable.Func
project and choose optionSet as Startup Project
. - Run project using Visual Studio.
Using DotNet CLI
If you wish to build the solution using dotnet CLI, you will need to run the following command from the root directory.
dotnet build Backend/
For building inidividual projects, you will need to specify the path to the directory containing the csproj.
dotnet build Backend/src/Trackable.Web/
For running the Rest Service you would use
dotnet run --project Backend/src/Trackable.Web/Trackable.Web.csproj