diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/AbpProWebGatewayModule.cs b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/AbpProWebGatewayModule.cs
deleted file mode 100644
index 254c8d09..00000000
--- a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/AbpProWebGatewayModule.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using Lion.AbpPro.AspNetCore;
-
-namespace Lion.AbpPro.WebGateway
-{
- [DependsOn(
- typeof(AbpProAspNetCoreModule))]
- public class AbpProWebGatewayModule : AbpModule
- {
- private const string DefaultCorsPolicyName = "Default";
-
- public override void ConfigureServices(ServiceConfigurationContext context)
- {
- ConfigureCors(context);
-
- }
-
- public override void OnApplicationInitialization(ApplicationInitializationContext context)
- {
- var app = context.GetApplicationBuilder();
- app.UseCorrelationId();
- app.UseCors(DefaultCorsPolicyName);
- app.UseRouting();
- app.UseConfiguredEndpoints(endpoints => { endpoints.MapHealthChecks("/health"); });
- app.UseWebSockets();
- app.UseOcelot().Wait();
- }
-
- ///
- /// 配置跨域
- ///
- private void ConfigureCors(ServiceConfigurationContext context)
- {
- var configuration = context.Services.GetConfiguration();
- context.Services.AddCors(options =>
- {
- options.AddPolicy(DefaultCorsPolicyName, builder =>
- {
- builder
- .WithOrigins(
- configuration["App:CorsOrigins"]
- .Split(",", StringSplitOptions.RemoveEmptyEntries)
- .Select(o => o.RemovePostFix("/"))
- .ToArray()
- )
- .WithAbpExposedHeaders()
- .SetIsOriginAllowedToAllowWildcardSubdomains()
- .AllowAnyHeader()
- .AllowAnyMethod()
- .AllowCredentials();
- });
- });
- }
-
- }
-}
\ No newline at end of file
diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/MyProjectNameWebGatewayModule.cs b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/MyProjectNameWebGatewayModule.cs
new file mode 100644
index 00000000..dad7db3c
--- /dev/null
+++ b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/MyProjectNameWebGatewayModule.cs
@@ -0,0 +1,26 @@
+using Lion.AbpPro.AspNetCore;
+using Volo.Abp.AspNetCore.Mvc;
+
+namespace Lion.AbpPro.WebGateway;
+
+[DependsOn(
+ typeof(AbpAspNetCoreMvcModule),
+ typeof(AbpProAspNetCoreModule))]
+public class MyProjectNameWebGatewayModule : AbpModule
+{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ context.Services.AddAbpProHealthChecks();
+ context.Services.AddAbpProOcelot();
+ }
+
+ public override void OnApplicationInitialization(ApplicationInitializationContext context)
+ {
+ var app = context.GetApplicationBuilder();
+ app.UseCorrelationId();
+ app.UseRouting();
+ app.UseConfiguredEndpoints(endpoints => { endpoints.MapHealthChecks("/health"); });
+ app.UseWebSockets();
+ app.UseOcelot().Wait();
+ }
+}
\ No newline at end of file
diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/Program.cs b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/Program.cs
index 3c1a2404..c45d3b1c 100644
--- a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/Program.cs
+++ b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/Program.cs
@@ -1,13 +1,14 @@
-namespace Lion.AbpPro.WebGateway
+using Lion.AbpPro.WebGateway;
+
+namespace MyCompanyName.MyProjectName.WebGateway
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
- builder.Host
- .UseAutofac();
- await builder.AddApplicationAsync();
+ builder.Host.UseAutofac();
+ await builder.AddApplicationAsync();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/appsettings.Consul.json b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/appsettings.Consul.json
deleted file mode 100644
index 28fa0fb4..00000000
--- a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/appsettings.Consul.json
+++ /dev/null
@@ -1,48 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft": "Warning",
- "Microsoft.Hosting.Lifetime": "Information"
- }
- },
- "AllowedHosts": "*",
- "App": {
- "SelfUrl": "http://120.24.194.14:8014",
- "CorsOrigins": "http://localhost:4200,http://120.24.194.14:8012,http://120.24.194.14:8011,http://120.24.194.14:8013"
- },
- "GlobalConfiguration": {
- },
- "Routes": [
- {
- "DownstreamPathTemplate": "/{url}",
- "DownstreamScheme": "http",
- "ServiceName": "MyProjectName-Service",
- "LoadBalancerOptions": {
- "Type": "LeastConnection"
- },
- "UpstreamPathTemplate": "/gateway/{url}",
- "UpstreamHttpMethod": [
- "Get",
- "Post",
- "Put",
- "Delete"
- ]
- },
- {
- "DownstreamPathTemplate": "/{url}",
- "DownstreamScheme": "ws",
- "ServiceName": "MyProjectName-Service",
- "LoadBalancerOptions": {
- "Type": "LeastConnection"
- },
- "UpstreamPathTemplate": "/ws/{url}",
- "UpstreamHttpMethod": [
- "Get",
- "Post",
- "Put",
- "Delete"
- ]
- }
- ]
-}
diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/appsettings.Production.json b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/appsettings.Production.json
index 8d40287f..4894c35f 100644
--- a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/appsettings.Production.json
+++ b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/appsettings.Production.json
@@ -7,22 +7,16 @@
}
},
"AllowedHosts": "*",
- "App": {
- "SelfUrl": "http://localhost:44314",
- "CorsOrigins": "http://*:*,https://*,http://*,http://localhost"
- },
"GlobalConfiguration": {
},
"Routes": [
{
"DownstreamPathTemplate": "/{url}",
"DownstreamScheme": "http",
- "DownstreamHostAndPorts": [
- {
- "Host": "lion.abp.pro",
- "Port": 8080
- }
- ],
+ "ServiceName": "MyCompanyName.MyProjectName.Api",
+ "LoadBalancerOptions": {
+ "Type": "LeastConnection"
+ },
"UpstreamPathTemplate": "/gateway/{url}",
"UpstreamHttpMethod": [
"Get",
@@ -34,12 +28,10 @@
{
"DownstreamPathTemplate": "/{url}",
"DownstreamScheme": "ws",
- "DownstreamHostAndPorts": [
- {
- "Host": "lion.abp.pro",
- "Port": 8080
- }
- ],
+ "ServiceName": "MyCompanyName.MyProjectName.Api",
+ "LoadBalancerOptions": {
+ "Type": "LeastConnection"
+ },
"UpstreamPathTemplate": "/ws/{url}",
"UpstreamHttpMethod": [
"Get",
@@ -49,4 +41,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/appsettings.json b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/appsettings.json
index 11ae9e2d..4894c35f 100644
--- a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/appsettings.json
+++ b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/appsettings.json
@@ -7,22 +7,16 @@
}
},
"AllowedHosts": "*",
- "App": {
- "SelfUrl": "http://localhost:44314",
- "CorsOrigins": "http://localhost:4200"
- },
"GlobalConfiguration": {
},
"Routes": [
{
"DownstreamPathTemplate": "/{url}",
"DownstreamScheme": "http",
- "DownstreamHostAndPorts": [
- {
- "Host": "localhost",
- "Port": 44315
- }
- ],
+ "ServiceName": "MyCompanyName.MyProjectName.Api",
+ "LoadBalancerOptions": {
+ "Type": "LeastConnection"
+ },
"UpstreamPathTemplate": "/gateway/{url}",
"UpstreamHttpMethod": [
"Get",
@@ -34,12 +28,10 @@
{
"DownstreamPathTemplate": "/{url}",
"DownstreamScheme": "ws",
- "DownstreamHostAndPorts": [
- {
- "Host": "localhost",
- "Port": 44315
- }
- ],
+ "ServiceName": "MyCompanyName.MyProjectName.Api",
+ "LoadBalancerOptions": {
+ "Type": "LeastConnection"
+ },
"UpstreamPathTemplate": "/ws/{url}",
"UpstreamHttpMethod": [
"Get",