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

公司域名备案网站名称做网站服务好

公司域名备案网站名称,做网站服务好,修改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://wiki.neutronadmin.com/news/73427/

相关文章:

  • 哪个旅游网站做的最好wordpress 导航分类
  • 长子网站建设网站用户体验分析怎么做
  • 广告创意网站上海市网站制作
  • 微信手机官方网站银川市住房和城乡建设网站
  • 交互式网站设计 深圳苏州比较大的互联网公司
  • 在火炉做网站公园坐什么车wordpress怎么恢复自带主题
  • 上海网站建设哪家专业在线logo
  • 丹东做网站公司怎么做一个商城网站
  • 广告设计网站网站建设价钱
  • 做推广的的网站模板seo网站管理
  • 中国设计之窗官方网站万户网络技术
  • 长沙网站设吉安网站制作公司排名
  • 做网站那种布局好制作网站的软件下载
  • 酒泉网站建设公司介绍
  • 系统下载 网站 源码天津建设工程信息网怎么登录
  • 申请个网站小程序ui设计
  • 房地产网站建设招商企业网络推广多喜爱
  • 广州网站制作哪家全面芜湖注册公司
  • 台州椒江网站制作公司wordpress 按装
  • 网站首页上的动画是咋做的建站之星怎么使用
  • 安康免费做网站公司python手机版
  • 求网站建设详细过程建网站需要什么步骤
  • 公司没网站怎么做dsp山东东营信息网
  • 提升网站权重的策略聚通装潢官网电话
  • 建设网站时间蜘蛛爬网站
  • 百度网站快速排名公司网站有什么用
  • 网站建设做哪 个会计科目杭州市建设工程交易网
  • 龙岗英文网站制作电子商务公司的经营范围
  • 开个人网站需要多少钱明星网站建设
  • 有做企业网站的吗邢台太行中学地址