|
|
@ -68,33 +68,33 @@ namespace Win_in.Sfs.Wms.Pda; |
|
|
|
typeof(MessageApplicationContractsModule), |
|
|
|
typeof(AuthApplicationContractsModule) |
|
|
|
)] |
|
|
|
public class PdaHttpApiHostModule : AbpModule |
|
|
|
public class PdaHttpApiHostModule : ModuleBase<PdaHttpApiHostModule> |
|
|
|
{ |
|
|
|
private bool _isMultiTenancy = true; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 预配置服务
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="context"></param>
|
|
|
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
context.Services.AddAutoMapperObjectMapper<AbpDddDomainModule>(); |
|
|
|
Configure<AbpAutoMapperOptions>(options => { options.AddMaps<PdaHttpApiHostModule>(validate: true); }); |
|
|
|
///// <summary>
|
|
|
|
///// 预配置服务
|
|
|
|
///// </summary>
|
|
|
|
///// <param name="context"></param>
|
|
|
|
//public override void PreConfigureServices(ServiceConfigurationContext context)
|
|
|
|
//{
|
|
|
|
// context.Services.AddAutoMapperObjectMapper<AbpDddDomainModule>();
|
|
|
|
// Configure<AbpAutoMapperOptions>(options => { options.AddMaps<PdaHttpApiHostModule>(validate: true); });
|
|
|
|
|
|
|
|
PreConfigure<AbpHttpClientBuilderOptions>(options => |
|
|
|
{ |
|
|
|
//Polly 重试3次
|
|
|
|
options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) => |
|
|
|
{ |
|
|
|
clientBuilder.AddTransientHttpErrorPolicy(policyBuilder => |
|
|
|
policyBuilder.WaitAndRetryAsync( |
|
|
|
3, |
|
|
|
i => TimeSpan.FromSeconds(Math.Pow(2, i)) |
|
|
|
) |
|
|
|
); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
// PreConfigure<AbpHttpClientBuilderOptions>(options =>
|
|
|
|
// {
|
|
|
|
// //Polly 重试3次
|
|
|
|
// options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) =>
|
|
|
|
// {
|
|
|
|
// clientBuilder.AddTransientHttpErrorPolicy(policyBuilder =>
|
|
|
|
// policyBuilder.WaitAndRetryAsync(
|
|
|
|
// 3,
|
|
|
|
// i => TimeSpan.FromSeconds(Math.Pow(2, i))
|
|
|
|
// )
|
|
|
|
// );
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
//}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
@ -113,26 +113,27 @@ public class PdaHttpApiHostModule : AbpModule |
|
|
|
/// <param name="context"></param>
|
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
_ = context.Services.GetHostingEnvironment(); |
|
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
|
//_ = context.Services.GetHostingEnvironment();
|
|
|
|
//var configuration = context.Services.GetConfiguration();
|
|
|
|
|
|
|
|
context.SetConsoleTitleOfWebApp("Pda.Host"); |
|
|
|
//context.SetConsoleTitleOfWebApp("Pda.Host");
|
|
|
|
|
|
|
|
_isMultiTenancy = Convert.ToBoolean(configuration["IsMultiTenancy"]); |
|
|
|
//_isMultiTenancy = Convert.ToBoolean(configuration["IsMultiTenancy"]);
|
|
|
|
|
|
|
|
ConfigureHttpClientProxies(context); |
|
|
|
//ConfigureHttpClientProxies(context);
|
|
|
|
|
|
|
|
ConfigureMultiTenancy(); |
|
|
|
//ConfigureMultiTenancy();
|
|
|
|
|
|
|
|
ConfigureSwaggerServices(context, configuration); |
|
|
|
base.ConfigureServices(context); |
|
|
|
GetXmlFiles(); |
|
|
|
|
|
|
|
ConfigureLocalization(); |
|
|
|
//ConfigureLocalization();
|
|
|
|
|
|
|
|
ConfigureAuthentication(context, configuration); |
|
|
|
//ConfigureAuthentication(context, configuration);
|
|
|
|
|
|
|
|
ConfigureCors(context, configuration); |
|
|
|
//ConfigureCors(context, configuration);
|
|
|
|
|
|
|
|
ConfigureAntiForgery(); |
|
|
|
//ConfigureAntiForgery();
|
|
|
|
} |
|
|
|
|
|
|
|
private void ConfigureAntiForgery() |
|
|
|