步骤按照官方的来就行
API/Dynamic CSharp API Clients | Documentation Center | ABP.IO
但有一点要注意,这也是官方文档没提及的,比如你在application这一层调用另一个项目的api客户端
则要在application层的module里加上依赖,这个容易忘记。
[DependsOn( typeof(BankHttpApiClientModule), typeof(WapHttpApiClientModule), typeof(ContractDomainModule), typeof(AbpTenantManagementApplicationModule), typeof(AbpFeatureManagementApplicationModule), typeof(AbpSettingManagementApplicationModule), typeof(ContractApplicationContractsModule) )] public class ContractApplicationModule : AbpModule
api之间的调用需要传递access_token的时候,需要在host或web项目里加上一下代码
appsettings.json
"RemoteServices": { "Default": { "BaseUrl": "http://localhost:7003/", "UseCurrentAccessToken": "true" }, "Contracts": { "BaseUrl": "http://localhost:7002/", "UseCurrentAccessToken": "true" }, "Bank": { "BaseUrl": "http://localhost:7003/", "UseCurrentAccessToken": "true" }, "CustomerWap": { "BaseUrl": "http://localhost:7001/", "UseCurrentAccessToken": "true" }
同时在项目的module上加上
install-package Volo.Abp.Http.Client.IdentityModel.Web -version 4.4.4
[DependsOn( typeof(AbpHttpClientIdentityModelWebModule) )]
标签:http,BaseUrl,abp,api,UseCurrentAccessToken,typeof,true,客户端 From: https://www.cnblogs.com/helloStone/p/17603139.html