LogoLogo
HomePricingDocumentation
  • 💿Getting Started
    • Installation and Project Setup
    • Hello Perigee!
    • Perigee Application Design
    • Hello Configuration
    • Hello Logs
    • Hello Integration
    • Troubleshooting
    • Case Studies
  • 📃License + Notice
    • 📂Licensing
    • Notice of Third Party Agreements
  • 🚀Perigee and Beyond
    • Extending - Threads
    • Extending - Loaders
    • ⏳All about CRON
  • 🔮API Generation
    • What is API Generation?
    • API Builder
  • 🗺️Architecting YOUR App
    • Design and Requirements
    • Define Sources
    • Requirements
  • 🧩Core Modules
    • 🌐PerigeeApplication
    • 🪡Thread Registry
    • Event Sources
      • Scheduled/Logic
        • CRON Thread
        • Scheduler
        • Sync Agent
      • Watchers
        • SalesForce
        • Sharepoint
        • Directory Watch
        • Directory Notifier
        • IMAP
    • Credential Management
      • Connection Strings
      • Custom Refresh Logic
      • RestSharp Authenticator
      • Credential Store SDK
      • ⁉️Troubleshooting Credentials
    • Integration Utilities
      • HTTP(S) - RestSharp
      • Transaction Coordinator
      • Limiter
      • Watermarking
    • Alert Managers
      • SMS
      • Email
      • Discord
      • Teams
    • File Formats
      • Excel
      • CSV
    • 📁File System Storage
      • File Revision Store
      • Concurrent File Store
      • FileSync + Cache
    • Third Party
      • SmartSheets
      • Microsoft Graph
    • Perigee In Parallel
      • Parallel Processing Reference
      • Extensions
      • GroupProcessor
      • SingleProcessor
    • 🧱Utility Classes
      • Metrics
      • F(x) Expressions
      • Multi-Threaded Processor (Scatter Gather)
      • OpenAI - GPT
      • XML Converter
      • Dynamic Data Table
      • Debounce
      • Thread Conditions
      • Perigee Utility Class
      • Network Utility
      • Lists
      • FileUtil
      • Inclusive2DRange
      • Strings, Numbers, Dates
      • Nested Sets
      • Behavior Trees
      • JsonCompress
      • Topological Sorting
      • DBDownloader
    • 🈁Bit Serializer
  • 📣Examples and Demos
    • API + Perigee
    • 📰Excel Quick Load
    • SalesForce Watcher
    • Report Scheduler
    • Agent Data Synchronization
    • 📩IMAP Echo bot
    • Watch and load CSVs
    • Graph Delegated Authorization + DataVerse
    • Coordinator Demo
    • Azure Service Bus
    • QuickBooks Online
  • 📘Blueprints
    • Perigee With .NET Hosting
    • Web Host Utilities
    • 🔌Plugin Load Context
  • 🎞️Transforms
    • 🌟What is Transforms?
    • 📘Terminology
    • 🦾The Mapping Document
    • 👾Transformation Process
    • 😎Profile
    • 🎒Automation
      • 🕓Package Options
      • 🔳Configuration
    • 🔧Utilities
      • 🧹Clean
      • 📑Map File
      • 🔎File Identification
      • 🗺️Map Generation
      • 🪅Insert Statement Generation
  • 🗃️Transform SDK
    • 👋Quick Start Guide
    • 🥳MapTo
    • 🔌Authoring Plugins
      • 🔘File IO Process
      • 📢Data Quality
      • 🟢Transform Process
    • SDK Reference
      • 🔘FileIOProcessData
      • 📢DataQualityContext
      • 🎛️TransformDataContext
      • 🏅TransformResult
Powered by GitBook
On this page
  • 1- Create an ASP.NET Core Web API project
  • 2- Configure the application as needed
  • 3 - Setup Program.cs
  • 4 - Installation
  • 5- AppSettings.json
  • 6- License file
  • Running the application
Export as PDF
  1. Blueprints

Perigee With .NET Hosting

PreviousQuickBooks OnlineNextWeb Host Utilities

Last updated 1 year ago

Here's the full setup guide for a Perigee Application with included API hosting, CORS, and swagger. You can download the completed result here:

1- Create an ASP.NET Core Web API project

Using Visual Studio we are going to create a new project. We want to select "ASP.NET Core Web API".

2- Configure the application as needed

When you get to configuration, feel free to override these settings as desired. An example configuration of this is shown below.

3 - Setup Program.cs

After opening Program.cs - the template created a project for us which looks like this:

We're going to add a few things to this basic setup to get it fully configured for Perigee.

  • We're going to add the ThreadRegistry instance to the builder host services.

  • We need to use Serilog.

  • Let's add CORS for cross origin.

  • Instead of running the application in synchronous mode we capture the asynchronous task handle.

  • Pass it to Perigee.

The "new" Program.cs

using Perigee;
using Serilog;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddSingleton(ThreadRegistry.Instance);
builder.Host.UseSerilog();

//Controllers
builder.Services.AddControllers();

//SwaggerGen - https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer().AddSwaggerGen();

//Build / configure
var app = builder.Build();
if (app.Environment.IsDevelopment()) app.UseSwagger().UseSwaggerUI();

// HTTPS/Auth/Controllers/Cors
app.UseHttpsRedirection().UseAuthorization();
app.MapControllers();
app.UseCors(o => o.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
app.UseSerilogRequestLogging();

//Run async!
var taskRunner = app.RunAsync();

//Pass the taskRunner to Perigee initialization
PerigeeApplication.ApplicationNoInit("Hosted Perigee App", (c) => {

    //Add and configure away

    //Sample running config
    c.AddRecurring("Running", (c, l) => { l.LogInformation("I'm running"); });

}, HostTask: taskRunner);

/*********************************************************************/
// TODO:
// Using the package manager console, or the Nuget GUI: install-package Perigee
// Add AppSettings.json and set the "Copy To Output Directory" in the Properties inspector to "Copy Always"
/*********************************************************************/

4 - Installation

We need to install Perigee as a dependency.

Either use the Nuget GUI or the Package Manager Console and type install-package Perigee

5- AppSettings.json

The AppSettings.json file is slightly different when using .NET hosting, as we want to turn off the debug level logging for Serilog and AspNetcore.

{
  "ConnectionStrings": {

  },
  "AppSettings": {

  },
  "Perigee": { "HideConsole": false },
  "Serilog": {
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft": "Warning",
        "System": "Warning",
        "Microsoft.AspNetCore": "Warning"
      }
    },
    "WriteTo": [
      { "Name": "Console" }
    ]
  },
  "AllowedHosts": "*"
}

File / Copy Settings

Depending on the template and .NET version you selected the appsettings.json file may or may not exist. Feel free to download and drop in the one provided if it is not automatically included. As always, make sure this is set to "Copy Always" in the Property Inspector.

6- License file

Please copy your license file into the project root and set to "Copy Always"

Running the application

After clicking "Run" - You should see Swagger in the default browser, and the Perigee application console window with .NET hosting running.

📘
405B
appsettings.json
4KB
PerigeeAPI.zip
archive
Page cover image