1.ABP动态代理是根据我们定义的IxxAppService 接口生成的Resutful风格的Http请求实现

2.默认只需要依赖 AbpHttpClientModule 模块 和你的 xxApplicationContractsModule 应用接口模块

  [DependsOn(new Type[] {typeof (AbpHttpClientModule), typeof (XXApplicationContractsModule)})]
  public class LibraDataCollectionHttpApiClientModule : AbpModule
  {
    public const string RemoteServiceName = "XX.DataCollection";

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
      context.Services.AddHttpClientProxies(typeof (XXApplicationContractsModule).Assembly, "XX.DataCollection", true, (Action<IHttpClientBuilder>) null);
    }
  }

使用直接在客户端 构造函数注入你的 IxxAppService 接口 就可以使用了 

下面介绍如何修改客户端Http请求超时时间

首先源码分析

动态代理实现的代码模块包为 Volo.Abp.Http.Client

定位到动态实现关键类  DynamicHttpProxyInterceptor

ABP动态代理请求超时时间设置

 

 

 找到构建Http请求 关键方法

ABP动态代理请求超时时间设置

 

 

 ABP动态代理请求超时时间设置

 

 并且找到默认实现类

ABP动态代理请求超时时间设置

 

 重新接口 并且替换默认实现即可

ABP动态代理请求超时时间设置

 接下来处理服务端超时问题

ABP动态代理请求超时时间设置

 

 如果是不是在IIS上 IIS 作为反向代理工具 也需要单独设置超时时间

ABP动态代理请求超时时间设置

 

 在Visual Studio中使用IIS Express调试时的设置方法

ABP动态代理请求超时时间设置

 

相关文章:

  • 2022-12-23
  • 2021-07-28
  • 2021-05-17
  • 2022-12-23
  • 2021-12-15
  • 2021-06-03
  • 2021-07-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2022-02-14
相关资源
相似解决方案