File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,8 @@ static async Task Main(string[] args)
2828 services . AddLogging ( )
2929 //单机版Httpclient配置
3030 . AddHttpClient ( TestServerName , client => { client . BaseAddress = new Uri ( "http://localhost:34047" ) ; } )
31- . AddDotNetCoreRpcClient ( options => {
31+ . AddDotNetCoreRpcClient ( options =>
32+ {
3233 options . Path = "/Test.Server6" ;
3334 options . AddRpcClient < IPersonService > ( ) . AddRpcClient < IProductService > ( ) ;
3435 } ) ;
@@ -37,8 +38,13 @@ static async Task Main(string[] args)
3738 //.AddScoped<NacosDiscoveryDelegatingHandler>()
3839 //.AddHttpClient(TestServerName, client =>
3940 //{
40- // client.BaseAddress = new Uri($"http://{TestServerName}/Test.Server6");
41- //}).AddHttpMessageHandler<NacosDiscoveryDelegatingHandler>();
41+ // client.BaseAddress = new Uri($"http://{TestServerName}");
42+ //})
43+ //.AddHttpMessageHandler<NacosDiscoveryDelegatingHandler>()
44+ //.AddDotNetCoreRpcClient(options => {
45+ // options.Path = "/Test.Server6";
46+ // options.AddRpcClient<IPersonService>().AddRpcClient<IProductService>();
47+ //});
4248
4349 using var scope = services . BuildServiceProvider ( ) . CreateScope ( ) ;
4450 IServiceProvider serviceProvider = scope . ServiceProvider ;
Original file line number Diff line number Diff line change 11using DotNetCoreRpc . Server ;
2+ using Microsoft . Extensions . Configuration ;
3+ using Nacos . AspNetCore . V2 ;
4+ using Nacos . V2 . Naming . Dtos ;
25using Test . DAL ;
36using Test . IDAL ;
47using Test . IService ;
1821 options . AddFilter < CacheFilter > ( ) ;
1922 } ) ;
2023
24+ //builder.Services.AddNacosAspNet(builder.Configuration);
25+
2126var app = builder . Build ( ) ;
2227
2328app . UseDotNetCoreRpc ( "/Test.Server6" ) ;
Original file line number Diff line number Diff line change 66 <ImplicitUsings >enable</ImplicitUsings >
77 </PropertyGroup >
88
9+ <ItemGroup >
10+ <PackageReference Include =" nacos-sdk-csharp.AspNetCore" Version =" 1.1.0" />
11+ </ItemGroup >
12+
913 <ItemGroup >
1014 <ProjectReference Include =" ..\..\src\DotNetCoreRpc.Server\DotNetCoreRpc.Server.csproj" />
1115 <ProjectReference Include =" ..\Test.DAL\Test.DAL.csproj" />
Original file line number Diff line number Diff line change 55 "Microsoft.AspNetCore" : " Warning"
66 }
77 },
8+ "nacos" : {
9+ "ServerAddresses" : [ " http://localhost:8848" ],
10+ "ServiceName" : " testserver" ,
11+ "DefaultTimeOut" : 15000 ,
12+ //自定义Namespace的Id
13+ "Namespace" : " 01761089-727d-49cb-9abe-fbe647f83927" ,
14+ "GroupName" : " DEFAULT_GROUP" ,
15+ "ClusterName" : " DEFAULT" ,
16+ "ListenInterval" : 1000 ,
17+ "RegisterEnabled" : true ,
18+ "InstanceEnabled" : true ,
19+ "LBStrategy" : " WeightRandom" ,
20+ "NamingUseRpc" : true
21+ },
822 "AllowedHosts" : " *"
923}
You can’t perform that action at this time.
0 commit comments