Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

使用 C# 构建 Lambda 函数

聚焦模式
使用 C# 构建 Lambda 函数 - Amazon Lambda

您可以使用托管的 .NET 8 运行时系统、自定义运行时系统或容器映像,在 Lambda 中运行您的 .NET 应用程序。编译应用程序代码后,您可以将其作为 .zip 文件或容器映像部署到 Lambda。Lambda 为.NET 语言提供以下运行时系统:

名称 标识符 操作系统 弃用日期 阻止函数创建 阻止函数更新

.NET 9(仅限容器)

dotnet9

Amazon Linux 2023

未计划

未计划

未计划

.NET 8

dotnet8

Amazon Linux 2023

2026 年 11 月 10 日

2026 年 12 月 10 日

2027 年 1 月 11 日

设置 .NET 开发环境

要开发和构建 Lambda 函数,您可以使用任何常用的 .NET 集成式开发环境(IDE),包括 Microsoft Visual Studio、Visual Studio Code 和 JetBrains Rider。为了简化您的开发体验,Amazon 提供了一组 .NET 项目模板以及 Amazon.Lambda.Tools 命令行界面(CLI)。

运行以下 .NET CLI 命令来安装这些项目模板和命令行工具。

安装 .NET 项目模板

要安装项目模板,请运行以下命令:

dotnet new install Amazon.Lambda.Templates

安装和更新 CLI 工具

运行以下命令来安装、更新和卸载 Amazon.Lambda.Tools CLI。

要安装命令行工具:

dotnet tool install -g Amazon.Lambda.Tools

要更新命令行工具:

dotnet tool update -g Amazon.Lambda.Tools

要卸载命令行工具:

dotnet tool uninstall -g Amazon.Lambda.Tools

下一主题:

处理程序 

上一主题:

跟踪