学习009-01 Create a Standalone Web API Application(创建一个独立的 Web API 应用程序 )

Create a Standalone Web API Application(创建一个独立的 Web API 应用程序 )

This topic contains step-by-step instructions on how to create an application with the Web API. For more information on the Web API, see the following topic: Backend Web API Service.
本主题包含有关如何使用Web API创建应用程序的分步说明。有关Web API的更多信息,请参阅以下主题:后端Web API服务。

Note
The Solution Wizard template for Web API .NET 6-based projects is available in Visual Studio 2022+ after you run the Universal Component Installer from the Download Manager.
Web API的解决方案向导模板。从下载管理器运行通用组件安装程序后,基于NET 6的项目在Visual Studio 2022+中可用。

1.Create a new solution in Visual Studio. Select the DevExpress v24.1 XAF Template Gallery project template and click Next.
在Visual Studio中创建新解决方案。选择DevExpress v24.1 XAF Template Gallery项目模板,然后单击Next。
在这里插入图片描述

2.Specify the name and location of the new project (solution), and click Create.
指定新项目(解决方案)的名称和位置,然后单击创建。

3.Ensure that the .NET Core platform is selected and run the XAF Solution Wizard.
确保.NET Core平台被选中并运行XAF解决方案向导。
在这里插入图片描述

4.In the Solution Wizard, select Service (ASP.NET Core Web API) and other platforms that you wish to add to the solution.
在解决方案向导中,选择要添加到解决方案的服务( ASP.NET Core Web API)和其他平台。
在这里插入图片描述

5.Select the eXpress Persistent Objects or Entity Framework Core ORM for your application and click Next.
为您的应用程序选择 eXpress Persistent Objects or Entity Framework Core ORM,然后单击下一步。
在这里插入图片描述

6.Choose the security options for your application.
为您的应用程序选择安全选项。
在这里插入图片描述

See the following topic for details: Authentication in Web API projects.
有关详细信息,请参阅以下主题:Web API项目中的身份验证。

If you selected ASP.NET Core Blazor on the Choose Target Platforms page, you can also specify if the Web API service should be added as a separate project or integrated into a Blazor application project:
如果您在选择目标平台页面上选择了ASP.NETCore Blazor,您还可以指定是否应将Web API服务添加为单独的项目或集成到Blazor应用程序项目中:
在这里插入图片描述

7.Select additional modules, if necessary. See the following documentation section for additional information on these extra modules: Paid/Enterprise Modules.
如有必要,请选择其他模块。有关这些额外模块的更多信息,请参阅以下留档部分:付费/企业模块。
在这里插入图片描述

8.Create endpoints and test the Web API.
创建端点并测试Web API。

9.This step only applies if you used the “Sha512” algorithm to encrypt passwords in your existing XAF application and want to reuse the same database. In such instances, set the PasswordCryptographer.SupportLegacySha512 property to true for backward compatibility.
仅当您使用"Sha512"算法加密现有XAF应用程序中的密码并希望重用同一数据库时,此步骤才适用。在这种情况下,请将PasswordCryptographer. SupportLegacySha512属性设置为true以实现向后兼容性。

File: MySolution.WebApi\Startup.cs

C#

public class Startup {
    // ...
    public void ConfigureServices(IServiceCollection services) {
        // ...
        PasswordCryptographer.SupportLegacySha512 = true;
        // ...
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

汤姆•猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值