当前位置: 首页 > news >正文

上海网站开发兼职wordpress tidio怎么用

上海网站开发兼职,wordpress tidio怎么用,WordPress评论博主,文字图片设计制作在线从模块化到微服务化从Pet Shop 到eShop on Container都是Microsoft在技术演进的路径上给开发者展示.Net的开发能力和架构能力的Sample工程#xff0c;Petshop的时候更多的是展现应用的分层架构#xff0c;设计的抽象与模块间的通讯。到了eShop on Container更多的关注在架构设… 从模块化到微服务化从Pet Shop 到eShop on Container都是Microsoft在技术演进的路径上给开发者展示.Net的开发能力和架构能力的Sample工程Petshop的时候更多的是展现应用的分层架构设计的抽象与模块间的通讯。到了eShop on Container更多的关注在架构设计与微服务化的下面我们先来看看eshop on Container的架构图在上图我们可以看到后端服务分成了Identity microservice(验证服务)Catalog microservice商品分类服务Ordering microservice订单服务Basket microservice购物车服务Marketing microservice市场营销服务Locations microservice地理位置信息服务在以前的分层架构中通常这些服务都是以某一模块来体现的为什么现在要将他们拆分成了各个服务呢当我们从业务场景上面来看这些服务时我们会发现每个服务的访问峰值时间区间、容量规划都是不一样的甚至实现这些服务最方便最简单的技术栈都有可能是不一样的当然强大的.net core无所不能但是公司内不同业务线上的技术储备不一样就有可能选择不同的技术实现。这是因为如果我们都将这些模块整合到了一个程序或者服务中的时候就会碰到在不同时间内服务高峰期扩展系统容量困难要不就是资源不足要不就是资源过剩。譬如抢购业务开始前大家提前个半小时登录了系统这时候系统最忙的是登录模块到了开始抢购时间系统最忙的是订单模块。不采用微服务架构的话半小时前准备给登录模块使用的资源不一定能够及时的释放出来给订单模块。如果两个模块都使用单一程序架构的话很可能出现的情况就是抢购的业务把所有资源都占满了了连其他正常访问系统的用户资源都被占用掉导致系统崩溃。在讲究Dev/Ops的今天开发人员和架构师需要更多的考虑硬件架构层面对程序应用带来的影响。用Service Fabric来承载eShop on Container微服务的方法一通过Service Fabric直接管理Docker首先我们先到Azure上申请一个Container Registry来承载eShop各个微服务程序的镜像(image).创建Azure Docker Registry可以参考官方文档https://docs.microsoft.com/zh-cn/azure/container-registry/现在最新版本Service Fabric已经可以直接管理编排Docker了。1.创建一个类型为Container的Service2.在servicemanifest.xml中描述清楚image所在路径CodePackage NameCode Version1.0.0    !-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers --    EntryPoint        ContainerHost        ImageNameeshopsample.azurecr.io/catalog:latest/ImageName             /ContainerHost          /EntryPoint    !-- Pass environment variables to your container: --       EnvironmentVariables      EnvironmentVariable NameHttpGatewayPort Value/    /EnvironmentVariables  /CodePackage这里非常简单指定了image所在位置就好了如果本身Docker Image里需要很多配置信息譬如数据库链接串、其他服务的地址等等都可以在EnvironmentVariables里面去配置。3.配置Registry的访问账号密码,需要在ApplicationManifest.xml上面来配置ServiceManifestImport    ServiceManifestRef ServiceManifestNameCatalogService_Pkg  ServiceManifestVersion1.0.1 /          Policies      ContainerHostPolicies CodePackageRefCode Isolationhyperv        RepositoryCredentials AccountNameyouraccount Passwordxxxxxxxxxxxxx PasswordEncryptedfalse/        PortBinding ContainerPort80 EndpointRefCatalogServieEndpoint/            /ContainerHostPolicies    /Policies  /ServiceManifestImport整个过程不会太复杂只要配置好了Catalog microserivce的ServiceManifest.xm和ApplicationManifest.xml文件之后我们可以用同样的方法将其他服务一一配置完成然后我们就可以将Service Fabric的配置Publish到Cluster上面了。Service Fabric会自动根据配置在Cluster上面Pull Image和将Docker运行起来。非常简单用Service Fabric承载eShop on Container微服务的方法二用Service Fabric的Runtime运行eShop on Container的微服务Service Fabric本身就是个微服务的开发框架现在已经直接支持了.net Core 2.0了所以我们更新了Service Fabric的SDK之后就可以直接创建.net core的服务了eShop on Container的代码都已经是一份成型的.net core 2.0的代码所以不需要重新编写服务。1.通过nuget添加最新的Service Fabric最新的SDK。2.修改programe.cs,启动ServiceFabric Runtime而不是直接启动Asp.net WebHostpublic static void Main(string[] args)        {            try            {                // ServiceManifest.XML 文件定义一个或多个服务类型名称。                // 注册服务会将服务类型名称映射到 .NET 类型。                // 在 Service Fabric 创建此服务类型的实例时                // 会在此主机进程中创建类的实例。                ServiceRuntime.RegisterServiceAsync(Catalog.API,                    context new CatalogAPI(context)).GetAwaiter().GetResult();                ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(CatalogAPI).Name);                // 防止此主机进程终止以使服务保持运行。                 Thread.Sleep(Timeout.Infinite);            }            catch (Exception e)            {                ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());                throw;            }}3.编写CatalogAPI 类用于启动WebHostinternal sealed class CatalogAPI : StatelessService    {        public CatalogAPI(StatelessServiceContext context)            : base(context)        { }        /// summary        /// Optional override to create listeners (like tcp, http) for this service instance.        /// /summary        /// returnsThe collection of listeners./returns        protected override IEnumerableServiceInstanceListener CreateServiceInstanceListeners()        {            return new ServiceInstanceListener[]            {                new ServiceInstanceListener(serviceContext                     new KestrelCommunicationListener(serviceContext, ServiceEndpoint, (url, listener)                     {                        ServiceEventSource.Current.ServiceMessage(serviceContext, $Starting WebListener on {url});                                                return new WebHostBuilder()                                         .UseKestrel()                                    .ConfigureServices(                                        services services                                            .AddSingletonStatelessServiceContext(serviceContext))                                    .UseContentRoot(Directory.GetCurrentDirectory())                                    .ConfigureAppConfiguration((builderContext, config)                                     {                                        IHostingEnvironment env builderContext.HostingEnvironment;                                        config.AddJsonFile(settings.json, optional: false, reloadOnChange: true)                                            .AddJsonFile($appsettings.{env.EnvironmentName}.json, optional: true, reloadOnChange: true);                                                                           })                                    .UseStartupStartup()                                    .UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None)                                    .UseUrls(url)                                    .UseWebRoot(Pics)                                    .Build();                                      }))            };        }    }4.编写serviceManifest.xml描述服务端口等信息?xml version1.0 encodingutf-8?ServiceManifest NameCatalog.APIPkg                 Version1.0.3                 xmlnshttp://schemas.microsoft.com/2011/01/fabric                 xmlns:xsdhttp://www.w3.org/2001/XMLSchema                 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance  ServiceTypes        StatelessServiceType ServiceTypeNameCatalog.API /  /ServiceTypes  !-- Code package is your service executable. --  CodePackage NameCode Version1.0.3    EntryPoint      ExeHost        ProgramCatalog.API.exe/Program        WorkingFolderCodePackage/WorkingFolder      /ExeHost    /EntryPoint    EnvironmentVariables      EnvironmentVariable NameASPNETCORE_ENVIRONMENT ValueDevelopment/    /EnvironmentVariables  /CodePackage  ConfigPackage NameConfig Version1.0.1 /  Resources       Endpoints           Endpoint Protocolhttp NameServiceEndpoint  TypeInput  Port5101 /    /Endpoints  /Resources/ServiceManifest5.修改AppcationManifest.xml增加几个服务的描述信息添加ServiceImport节ServiceManifestImportServiceManifestRef ServiceManifestNameCatalog.APIPkg ServiceManifestVersion1.0.3 /ConfigOverrides //ServiceManifestImport在DefaultService中描述ServiceService NameCatalog.API ServiceDnsNamecatalog.fabric.api      StatelessService ServiceTypeNameCatalog.API InstanceCount[Catalog.API_InstanceCount]        SingletonPartition /      /StatelessService    /Service这样我们就可以将Catalog这个服务改造成可以通过Service Fabric来管理的微服务了。通过Publish我们可看到几个服务都已经在Service Fabric下面接受管理和编排了。访问localhost:5100原文地址:https://www.cnblogs.com/wing-ms/p/8243020.html.NET社区新闻深度好文欢迎访问公众号文章汇总 http://www.csharpkit.com
http://icebutterfly214.com/news/17416/

相关文章:

  • 如何构建 AI 智能体(2025 完全指南)
  • Python的`__call__`方法:让对象变成“可调用函数”
  • 2025打圈机厂家推荐榜:佛山首域领衔,数控打圈机厂家聚焦精度与效率的实力之选
  • 别只调模型!RAG 检索优化真正该测的,是这三件事
  • 跳槽加分项:掌握Dify工作流,我薪资涨了40%
  • 深入解析:[Web网页] LAMP 架构与环境搭建
  • React系列教程:8. 传递函数
  • 杂题选记(10.26 - 11.1)
  • 2025年能注册公司代办的公司哪家好?
  • 2025年11月领先品牌认证机构评测榜:尚普咨询华信人数据对比
  • 2025年11月消防阀门厂家排名榜:国际认证与绿色制造指标评价
  • 2025年11月解酒护肝产品权威榜:蓝帽子认证与成分纯度全对比
  • 2025年11月解酒护肝产品实力榜:权威认证与用户体验深度评测
  • 2025年6月ai排名优化推荐排名榜:权威数据锁定五家优选
  • 从编译到防护:AIoT 开发的 避坑 与 提速 实战
  • 2025年6月GEO优化权威榜:五强对比评测助你决策
  • flanneld检查脚本
  • 2025年知名的减速机用户口碑最好的厂家榜
  • 2025年昆山上海叉车培训公司新排行榜,求推荐叉车培训公司
  • 2025年靠谱的智能无主灯办公楼系统厂家推荐及选择指南
  • 2025年质量好的地井空调通风软管厂家推荐及选购参考榜
  • 2025进出线电抗器厂家哪家好?电抗器厂家权威推荐榜单
  • Agora: language‑to‑protocol gateway.
  • 2025年评价高的减速机厂家最新用户好评榜
  • HbuildX,开发APP应用,真机调试时,netcore,net8.0无法访问本机调试运行的api接口的问题
  • 2025年11月烘干房源头厂家Top10推荐:四川蜀冷烘干房领跑行业
  • 筑牢安全基座——国产制品库如何重塑企业软件供应链防线?
  • C++23的out_ptr和inout_ptr
  • 2025年口碑好的陕西白水苹果精选优质产区
  • 【URP】Unity[后处理]景深DepthOfField