AHROdata 1.0.1
See the version list below for details.
dotnet add package AHROdata --version 1.0.1
NuGet\Install-Package AHROdata -Version 1.0.1
<PackageReference Include="AHROdata" Version="1.0.1" />
paket add AHROdata --version 1.0.1
#r "nuget: AHROdata, 1.0.1"
// Install AHROdata as a Cake Addin #addin nuget:?package=AHROdata&version=1.0.1 // Install AHROdata as a Cake Tool #tool nuget:?package=AHROdata&version=1.0.1
ASP.NET Core Minimal API Serverless Application
This project shows how to run an ASP.NET Core Web API project as an AWS Lambda exposed through Amazon API Gateway. The NuGet package Amazon.Lambda.AspNetCoreServer contains a Lambda function that is used to translate requests from API Gateway into the ASP.NET Core framework and then the responses from ASP.NET Core back to API Gateway.
For more information about how the Amazon.Lambda.AspNetCoreServer package works and how to extend its behavior view its README file in GitHub.
Executable Assembly
.NET Lambda projects that use C# top level statements like this project must be deployed as an executable assembly instead of a class library. To indicate to Lambda that the .NET function is an executable assembly the Lambda function handler value is set to the .NET Assembly name. This is different then deploying as a class library where the function handler string includes the assembly, type and method name.
To deploy as an executable assembly the Lambda runtime client must be started to listen for incoming events to process. For an ASP.NET Core application the Lambda runtime client is started by included the
Amazon.Lambda.AspNetCoreServer.Hosting
NuGet package and calling AddAWSLambdaHosting(LambdaEventSource.HttpApi)
passing in the event source while configuring the services of the application. The
event source can be API Gateway REST API and HTTP API or Application Load Balancer.
Project Files
- serverless.template - an AWS CloudFormation Serverless Application Model template file for declaring your Serverless functions and other AWS resources
- aws-lambda-tools-defaults.json - default argument settings for use with Visual Studio and command line deployment tools for AWS
- Program.cs - entry point to the application that contains all of the top level statements initializing the ASP.NET Core application.
The call to
AddAWSLambdaHosting
configures the application to work in Lambda when it detects Lambda is the executing environment.
You may also have a test project depending on the options selected.
Here are some steps to follow from Visual Studio:
To deploy your Serverless application, right click the project in Solution Explorer and select Publish to AWS Lambda.
To view your deployed application open the Stack View window by double-clicking the stack name shown beneath the AWS CloudFormation node in the AWS Explorer tree. The Stack View also displays the root URL to your published application.
Here are some steps to follow to get started from the command line:
Once you have edited your template and code you can deploy your application using the Amazon.Lambda.Tools Global Tool from the command line.
Install Amazon.Lambda.Tools Global Tools if not already installed.
dotnet tool install -g Amazon.Lambda.Tools
If already installed check if new version is available.
dotnet tool update -g Amazon.Lambda.Tools
Deploy application
cd "API-OData/src/API-OData"
dotnet lambda deploy-serverless
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Amazon.Lambda.AspNetCoreServer.Hosting (>= 1.6.0)
- AWSSDK.KeyManagementService (>= 3.7.200.19)
- AWSSDK.SecretsManager (>= 3.7.201.4)
- AWSSDK.SecurityToken (>= 3.7.201.15)
- Newtonsoft.Json (>= 13.0.3)
- NuGet.exe (>= 3.4.3)
- System.IdentityModel.Tokens.Jwt (>= 6.32.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.