Browse Source

Merge pull request #117 from abpframework/liangshiwei/patch

Application remote service configuration error
pull/119/head
maliming 4 years ago
committed by GitHub
parent
commit
6e9e5ab7ac
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbp.PublicWeb.csproj
  2. 14
      apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs

1
apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbp.PublicWeb.csproj

@ -6,6 +6,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.7" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="5.1.2" />
<PackageReference Include="Yarp.ReverseProxy" Version="1.0.0" />
</ItemGroup>

14
apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs

@ -20,6 +20,7 @@ using StackExchange.Redis;
using System;
using System.Net.Http.Headers;
using Microsoft.AspNetCore.HttpOverrides;
using Polly;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.AspNetCore.Authentication.OpenIdConnect;
@ -74,6 +75,19 @@ public class EShopOnAbpPublicWebModule : AbpModule
typeof(EShopOnAbpPublicWebModule).Assembly
);
});
PreConfigure<AbpHttpClientBuilderOptions>(options =>
{
options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) =>
{
clientBuilder.AddTransientHttpErrorPolicy(policyBuilder =>
policyBuilder.WaitAndRetryAsync(
3,
i => TimeSpan.FromSeconds(Math.Pow(2, i))
)
);
});
});
}
public override void ConfigureServices(ServiceConfigurationContext context)

Loading…
Cancel
Save