实例介绍
.NetCore+Consul+Ocelot实现服务网关和服务注册与发现,此Demo是个完整的列子,下载可直接运行。
【实例截图】
【核心代码】
4744300845375939904.rar
└── Canoe.Consul
├── Canoe.Configuration.Consul
│ ├── bin
│ │ └── Debug
│ │ └── netcoreapp3.1
│ │ ├── Canoe.Configuration.Consul.deps.json
│ │ ├── Canoe.Configuration.Consul.dll
│ │ └── Canoe.Configuration.Consul.pdb
│ ├── Canoe.Configuration.Consul.csproj
│ ├── ConsulBuilderExtensions.cs
│ ├── ConsulOption.cs
│ └── obj
│ ├── Canoe.Configuration.Consul.csproj.nuget.dgspec.json
│ ├── Canoe.Configuration.Consul.csproj.nuget.g.props
│ ├── Canoe.Configuration.Consul.csproj.nuget.g.targets
│ ├── Debug
│ │ └── netcoreapp3.1
│ │ ├── Canoe.Configuration.Consul.AssemblyInfo.cs
│ │ ├── Canoe.Configuration.Consul.AssemblyInfoInputs.cache
│ │ ├── Canoe.Configuration.Consul.assets.cache
│ │ ├── Canoe.Configuration.Consul.csprojAssemblyReference.cache
│ │ ├── Canoe.Configuration.Consul.csproj.CoreCompileInputs.cache
│ │ ├── Canoe.Configuration.Consul.csproj.FileListAbsolute.txt
│ │ ├── Canoe.Configuration.Consul.dll
│ │ └── Canoe.Configuration.Consul.pdb
│ ├── project.assets.json
│ └── project.nuget.cache
├── Canoe.Consul.sln
├── Canoe.GateWay
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── bin
│ │ └── Debug
│ │ └── net5.0
│ │ ├── appsettings.Development.json
│ │ ├── appsettings.json
│ │ ├── Canoe.GateWay.deps.json
│ │ ├── Canoe.GateWay.dll
│ │ ├── Canoe.GateWay.exe
│ │ ├── Canoe.GateWay.pdb
│ │ ├── Canoe.GateWay.runtimeconfig.dev.json
│ │ ├── Canoe.GateWay.runtimeconfig.json
│ │ ├── Consul.dll
│ │ ├── FluentValidation.dll
│ │ ├── Microsoft.AspNetCore.Authentication.JwtBearer.dll
│ │ ├── Microsoft.AspNetCore.Authentication.OpenIdConnect.dll
│ │ ├── Microsoft.AspNetCore.JsonPatch.dll
│ │ ├── Microsoft.AspNetCore.MiddlewareAnalysis.dll
│ │ ├── Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll
│ │ ├── Microsoft.Extensions.DiagnosticAdapter.dll
│ │ ├── Microsoft.IdentityModel.JsonWebTokens.dll
│ │ ├── Microsoft.IdentityModel.Logging.dll
│ │ ├── Microsoft.IdentityModel.Protocols.dll
│ │ ├── Microsoft.IdentityModel.Protocols.OpenIdConnect.dll
│ │ ├── Microsoft.IdentityModel.Tokens.dll
│ │ ├── Microsoft.OpenApi.dll
│ │ ├── Newtonsoft.Json.Bson.dll
│ │ ├── Newtonsoft.Json.dll
│ │ ├── Ocelot.dll
│ │ ├── ocelot.json
│ │ ├── Ocelot.Provider.Consul.dll
│ │ ├── ref
│ │ │ └── Canoe.GateWay.dll
│ │ ├── runtimes
│ │ │ ├── unix
│ │ │ │ └── lib
│ │ │ │ └── netstandard1.3
│ │ │ │ └── System.Net.Http.WinHttpHandler.dll
│ │ │ └── win
│ │ │ └── lib
│ │ │ └── netstandard1.3
│ │ │ └── System.Net.Http.WinHttpHandler.dll
│ │ ├── Swashbuckle.AspNetCore.Swagger.dll
│ │ ├── Swashbuckle.AspNetCore.SwaggerGen.dll
│ │ ├── Swashbuckle.AspNetCore.SwaggerUI.dll
│ │ └── System.IdentityModel.Tokens.Jwt.dll
│ ├── Canoe.GateWay.csproj
│ ├── Canoe.GateWay.csproj.user
│ ├── Controllers
│ │ └── WeatherForecastController.cs
│ ├── Dockerfile
│ ├── obj
│ │ ├── Canoe.GateWay.csproj.nuget.dgspec.json
│ │ ├── Canoe.GateWay.csproj.nuget.g.props
│ │ ├── Canoe.GateWay.csproj.nuget.g.targets
│ │ ├── Container
│ │ │ ├── ContainerCreationResult.cache
│ │ │ ├── ContainerDevelopmentMode.cache
│ │ │ ├── ContainerId.cache
│ │ │ ├── ContainerName.cache
│ │ │ ├── ContainerOperatingSystemFlavor.cache
│ │ │ ├── ContainerRunContext.cache
│ │ │ ├── OperatingSystemName.cache
│ │ │ └── TargetFramework.cache
│ │ ├── Debug
│ │ │ └── net5.0
│ │ │ ├── apphost.exe
│ │ │ ├── Canoe.GateWay.AssemblyInfo.cs
│ │ │ ├── Canoe.GateWay.AssemblyInfoInputs.cache
│ │ │ ├── Canoe.GateWay.assets.cache
│ │ │ ├── Canoe.GateWay.csprojAssemblyReference.cache
│ │ │ ├── Canoe.GateWay.csproj.CopyComplete
│ │ │ ├── Canoe.GateWay.csproj.CoreCompileInputs.cache
│ │ │ ├── Canoe.GateWay.csproj.FileListAbsolute.txt
│ │ │ ├── Canoe.GateWay.dll
│ │ │ ├── Canoe.GateWay.GeneratedMSBuildEditorConfig.editorconfig
│ │ │ ├── Canoe.GateWay.genruntimeconfig.cache
│ │ │ ├── Canoe.GateWay.MvcApplicationPartsAssemblyInfo.cache
│ │ │ ├── Canoe.GateWay.MvcApplicationPartsAssemblyInfo.cs
│ │ │ ├── Canoe.GateWay.pdb
│ │ │ ├── Canoe.GateWay.RazorTargetAssemblyInfo.cache
│ │ │ ├── ref
│ │ │ │ └── Canoe.GateWay.dll
│ │ │ └── staticwebassets
│ │ │ ├── Canoe.GateWay.StaticWebAssets.Manifest.cache
│ │ │ └── Canoe.GateWay.StaticWebAssets.xml
│ │ ├── project.assets.json
│ │ └── project.nuget.cache
│ ├── ocelot.json
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Startup.cs
│ └── WeatherForecast.cs
├── Canoe.ServiceA
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── bin
│ │ └── Debug
│ │ └── net5.0
│ │ ├── appsettings.Development.json
│ │ ├── appsettings.json
│ │ ├── Canoe.Configuration.Consul.dll
│ │ ├── Canoe.Configuration.Consul.pdb
│ │ ├── Canoe.ServiceA.deps.json
│ │ ├── Canoe.ServiceA.dll
│ │ ├── Canoe.ServiceA.exe
│ │ ├── Canoe.ServiceA.pdb
│ │ ├── Canoe.ServiceA.runtimeconfig.dev.json
│ │ ├── Canoe.ServiceA.runtimeconfig.json
│ │ ├── Consul.dll
│ │ ├── Microsoft.AspNetCore.Authentication.JwtBearer.dll
│ │ ├── Microsoft.AspNetCore.Authentication.OpenIdConnect.dll
│ │ ├── Microsoft.IdentityModel.JsonWebTokens.dll
│ │ ├── Microsoft.IdentityModel.Logging.dll
│ │ ├── Microsoft.IdentityModel.Protocols.dll
│ │ ├── Microsoft.IdentityModel.Protocols.OpenIdConnect.dll
│ │ ├── Microsoft.IdentityModel.Tokens.dll
│ │ ├── Microsoft.OpenApi.dll
│ │ ├── Newtonsoft.Json.dll
│ │ ├── ref
│ │ │ └── Canoe.ServiceA.dll
│ │ ├── Swashbuckle.AspNetCore.Swagger.dll
│ │ ├── Swashbuckle.AspNetCore.SwaggerGen.dll
│ │ ├── Swashbuckle.AspNetCore.SwaggerUI.dll
│ │ └── System.IdentityModel.Tokens.Jwt.dll
│ ├── Canoe.ServiceA.csproj
│ ├── Canoe.ServiceA.csproj.user
│ ├── Controllers
│ │ ├── HealthController.cs
│ │ └── WeatherForecastController.cs
│ ├── Dockerfile
│ ├── obj
│ │ ├── Canoe.ServiceA.csproj.nuget.dgspec.json
│ │ ├── Canoe.ServiceA.csproj.nuget.g.props
│ │ ├── Canoe.ServiceA.csproj.nuget.g.targets
│ │ ├── Container
│ │ │ ├── ContainerCreationResult.cache
│ │ │ ├── ContainerDevelopmentMode.cache
│ │ │ ├── ContainerId.cache
│ │ │ ├── ContainerName.cache
│ │ │ ├── ContainerOperatingSystemFlavor.cache
│ │ │ ├── ContainerRunContext.cache
│ │ │ ├── OperatingSystemName.cache
│ │ │ └── TargetFramework.cache
│ │ ├── Debug
│ │ │ └── net5.0
│ │ │ ├── apphost.exe
│ │ │ ├── Canoe.ServiceA.AssemblyInfo.cs
│ │ │ ├── Canoe.ServiceA.AssemblyInfoInputs.cache
│ │ │ ├── Canoe.ServiceA.assets.cache
│ │ │ ├── Canoe.ServiceA.csprojAssemblyReference.cache
│ │ │ ├── Canoe.ServiceA.csproj.CopyComplete
│ │ │ ├── Canoe.ServiceA.csproj.CoreCompileInputs.cache
│ │ │ ├── Canoe.ServiceA.csproj.FileListAbsolute.txt
│ │ │ ├── Canoe.ServiceA.dll
│ │ │ ├── Canoe.ServiceA.GeneratedMSBuildEditorConfig.editorconfig
│ │ │ ├── Canoe.ServiceA.genruntimeconfig.cache
│ │ │ ├── Canoe.ServiceA.MvcApplicationPartsAssemblyInfo.cache
│ │ │ ├── Canoe.ServiceA.MvcApplicationPartsAssemblyInfo.cs
│ │ │ ├── Canoe.ServiceA.pdb
│ │ │ ├── Canoe.ServiceA.RazorTargetAssemblyInfo.cache
│ │ │ ├── ref
│ │ │ │ └── Canoe.ServiceA.dll
│ │ │ └── staticwebassets
│ │ │ ├── Canoe.ServiceA.StaticWebAssets.Manifest.cache
│ │ │ └── Canoe.ServiceA.StaticWebAssets.xml
│ │ ├── project.assets.json
│ │ └── project.nuget.cache
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Startup.cs
│ └── WeatherForecast.cs
└── Canoe.ServiceB
├── appsettings.Development.json
├── appsettings.json
├── bin
│ └── Debug
│ └── net5.0
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── Canoe.Configuration.Consul.dll
│ ├── Canoe.Configuration.Consul.pdb
│ ├── Canoe.ServiceB.deps.json
│ ├── Canoe.ServiceB.dll
│ ├── Canoe.ServiceB.exe
│ ├── Canoe.ServiceB.pdb
│ ├── Canoe.ServiceB.runtimeconfig.dev.json
│ ├── Canoe.ServiceB.runtimeconfig.json
│ ├── Consul.dll
│ ├── Microsoft.AspNetCore.Authentication.JwtBearer.dll
│ ├── Microsoft.AspNetCore.Authentication.OpenIdConnect.dll
│ ├── Microsoft.IdentityModel.JsonWebTokens.dll
│ ├── Microsoft.IdentityModel.Logging.dll
│ ├── Microsoft.IdentityModel.Protocols.dll
│ ├── Microsoft.IdentityModel.Protocols.OpenIdConnect.dll
│ ├── Microsoft.IdentityModel.Tokens.dll
│ ├── Microsoft.OpenApi.dll
│ ├── Newtonsoft.Json.dll
│ ├── ref
│ │ └── Canoe.ServiceB.dll
│ ├── Swashbuckle.AspNetCore.Swagger.dll
│ ├── Swashbuckle.AspNetCore.SwaggerGen.dll
│ ├── Swashbuckle.AspNetCore.SwaggerUI.dll
│ └── System.IdentityModel.Tokens.Jwt.dll
├── Canoe.ServiceB.csproj
├── Canoe.ServiceB.csproj.user
├── Controllers
│ ├── HealthController.cs
│ └── WeatherForecastController.cs
├── Dockerfile
├── obj
│ ├── Canoe.ServiceB.csproj.nuget.dgspec.json
│ ├── Canoe.ServiceB.csproj.nuget.g.props
│ ├── Canoe.ServiceB.csproj.nuget.g.targets
│ ├── Container
│ │ ├── ContainerDevelopmentMode.cache
│ │ ├── ContainerId.cache
│ │ ├── ContainerName.cache
│ │ └── ContainerRunContext.cache
│ ├── Debug
│ │ └── net5.0
│ │ ├── apphost.exe
│ │ ├── Canoe.ServiceB.AssemblyInfo.cs
│ │ ├── Canoe.ServiceB.AssemblyInfoInputs.cache
│ │ ├── Canoe.ServiceB.assets.cache
│ │ ├── Canoe.ServiceB.csprojAssemblyReference.cache
│ │ ├── Canoe.ServiceB.csproj.CopyComplete
│ │ ├── Canoe.ServiceB.csproj.CoreCompileInputs.cache
│ │ ├── Canoe.ServiceB.csproj.FileListAbsolute.txt
│ │ ├── Canoe.ServiceB.dll
│ │ ├── Canoe.ServiceB.GeneratedMSBuildEditorConfig.editorconfig
│ │ ├── Canoe.ServiceB.genruntimeconfig.cache
│ │ ├── Canoe.ServiceB.MvcApplicationPartsAssemblyInfo.cache
│ │ ├── Canoe.ServiceB.MvcApplicationPartsAssemblyInfo.cs
│ │ ├── Canoe.ServiceB.pdb
│ │ ├── Canoe.ServiceB.RazorTargetAssemblyInfo.cache
│ │ ├── ref
│ │ │ └── Canoe.ServiceB.dll
│ │ └── staticwebassets
│ │ ├── Canoe.ServiceB.StaticWebAssets.Manifest.cache
│ │ └── Canoe.ServiceB.StaticWebAssets.xml
│ ├── project.assets.json
│ └── project.nuget.cache
├── Program.cs
├── Properties
│ └── launchSettings.json
├── Startup.cs
└── WeatherForecast.cs
54 directories, 226 files
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论