The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,115 other followers

Notes a on a step by step .NET standard based stack of applications with a central core

Posted by jpluimers on 2020/10/14

The idea is to have a stack of things that can be later put into multiple micro-service pillars.

Helpful: enable “Track Active Item in Solution Explorer”:

  1. Start with an empty repository; add an origin
  2. Add .gitignore / .gitattributes appropriate for C#, for instance from github.com/Microsoft/vswhere, git commit it, and push it withgit push -u origin master.
  3. Add a blank solution using Creating a blank Visual Studio solution without a directory, and sln Format Version numbers and EmptyVisualStudioSolution
  4. Open the solution
  5. Add an “ASP.NET Core Web Application”
  6. Choose “API” in the list of ASP.NET templates, without Authentication or Docker support (let’s keep the balance bit simple enough for now)
  7. Run with Ctrl-F5, then confirm the SSL development certificate, and install it:

    ---------------------------
    Security Warning
    ---------------------------
    You are about to install a certificate from a certification authority (CA) claiming to represent:
    
    localhost
    
    Windows cannot validate that the certificate is actually from "localhost". You should confirm its origin by contacting "localhost". The following number will assist you in this process:
    
    Thumbprint (sha1): 09EA054F 14D5D4CE 6B22C5F1 3E7EBDB5 F7583116
    
    Warning:
    
    If you install this root certificate, Windows will automatically trust any certificate issued by this CA. Installing a certificate with an unconfirmed thumbprint is a security risk. If you click "Yes" you acknowledge this risk.
    
    Do you want to install this certificate?
    
    
    ---------------------------
    Yes   No   
    ---------------------------
  8. Your browser now opens at a port for debugging: https://localhost:<port>/api/values, then tries to download the result as values.json.

    This is configured in Properties\launchSettings.json under "launchUrl": "api/values" (for the browser URL) and Controllers\ValuesController.cs under // GET api/values for the actual implementation.

  9. a

 

 

 

a

a

 

IHostedService

Have any service related stuff implement IHostedService, so it is easy to deploy it in all kinds of processes:

  • console to test
  • windows service
  • ASP.NET Core service
  • Linux host application

Background information at .NET: IHostedService « The Wiert Corner – irregular stream of stuff.

–jeroen

Related:

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: