startup

.net core的startup中配置读取

匿名 (未验证) 提交于 2019-12-03 00:15:02
public class Startup { public Startup(IHostingEnvironment env) { Configuration = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables() .Build(); } public IConfiguration Configuration { get; } 读取配置信息 Configuration.GetSection("AppConfig")["DbConn"] 来源:博客园 作者: 向萧 链接:https://www.cnblogs.com/dayang12525/p/11737133.html

状态类

匿名 (未验证) 提交于 2019-12-03 00:08:02
先定义一个State 基类, 按照上面说的状态需要的三个操作分别定义函数(startup, update, cleanup)。在 init 函数中定义了上面说的三个变量(next,persist,done),还有start_time 和 current_time 用于记录时间。 class State(): def __init__(self): self.start_time = 0.0 self.current_time = 0.0 self.done = False self.next = None self.persist = {} @abstractmethod def startup(self, current_time, persist): '''abstract method''' def cleanup(self): self.done = False return self.persist @abstractmethod def update(sefl, surface, keys, current_time): '''abstract method''' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 看一个状态类LoadScreen的具体实现,这个状态的显示效果如图3。 startup

Nacos 快速开始

匿名 (未验证) 提交于 2019-12-03 00:08:02
原文: https://nacos.io/zh-cn/docs/quick-start.html https://www.jianshu.com/p/16ff6d6db0cf Nacos安装: 1、从 Github 上下载源码 git clone https : //github.com/alibaba/nacos.git cd nacos / mvn - Prelease - nacos clean install - U ls - al distribution / target / // change the $version to your actual path cd distribution / target / nacos - server - $version / nacos / bin 2、启动服务 Linux/Unix/Mac 启动命令(standalone代表着单机模式运行,非集群模式): sh startup.sh -m standalone 如果您使用的是ubuntu系统,或者运行脚本报错提示[[符号找不到,可尝试如下运行: bash startup.sh -m standalone Windows 启动命令: cmd startup.cmd 或者双击startup.cmd运行文件。 3.服务注册&发现和配置管理 服务注册 curl -X POST

asp.net core 系列之Startup

匿名 (未验证) 提交于 2019-12-02 23:45:01
这篇文章简单记录 ASP.NET Core中 ,startup类的一些使用。 在 Startup类中,一般有两个方法: Configure 方法:创建应用的请求处理管道 它们都在应用启动时,被 ASP.NET Core runtime 调用: public class Startup { // Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ... } // Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app) { ... } } 当应用的 host 被built(建立)时,Startup类被指定到应用中。 而在 Program 中,当 host builder 上的 Build 被调用时,应用的 host 被 built 。 而 Startup类是通过调用WebHostBuilderExtensions.UseStartup<TStartup>方法指定的。 public class Program { public static void Main

外观模式

匿名 (未验证) 提交于 2019-12-02 23:06:17
外观模式是为了解决类与类之间的依赖关系的,就是把那些类的实例都放在一个Facade类中,降低类之间的耦合度 public class CPU { public void startup(){ System.out.println("CPU 启动"); } public void shutdown(){ System.out.println("CPU 关闭"); } } public class Memory { public void startup(){ System.out.println("内存启动"); } public void shutdown(){ System.out.println("内存关闭"); } } public class Disk { public void startup(){ System.out.println("磁盘启动"); } public void shutdown(){ System.out.println("磁盘关闭"); } } public class Computer { private CPU cpu; private Memory memory; private Disk disk; public Computer() { this.cpu = new CPU(); this.memory = new Memory();

DotNetCore深入了解之一Startup类

匿名 (未验证) 提交于 2019-12-02 22:56:40
一个典型的ASP.NET Core应用程序会包含Program与Startup两个文件。Program类中有应用程序的入口方法Main,其中的处理逻辑通常是创建一个WebHostBuilder,再生成WebHost,然后启动项目。 1 public static IWebHostBuilder CreateWebHostBuilder( string [] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>(); View Code UseStartup方法的实现内容: 1 public static IWebHostBuilder UseStartup( this IWebHostBuilder hostBuilder, Type startupType) 2 { 3 var startupAssemblyName = startupType.GetTypeInfo().Assembly.GetName().Name; 4 5 return hostBuilder 6 .UseSetting(WebHostDefaults.ApplicationKey, startupAssemblyName) 7 .ConfigureServices(services => 8 { 9 if ( typeof

.NET Core2.0学习记录(1)

匿名 (未验证) 提交于 2019-12-02 22:10:10
微软发布asp.net core已经过去很长的时间了,我还没有接触,从现在开始一点点去学习。 一、Db_First 1、新建一个asp.net core mvc的项目 2、通过NuGet,安装Entity Framework Core Install-Package Microsoft.EntityFrameworkCore.SqlServer Install-Package Microsoft.EntityFrameworkCore.Tools Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Design 3、在Sql Server中新建数据库和数据表 4、使用Db_First把数据库信息添加到项目中:工具---NuGet包管理器---程序包管理器控制台 Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=MyCore1;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models(所有的表) Scaffold-DbContext "Server=.;Database=MyCore1;Trusted_Connection=True;"

Suring开发集成部署时问题记录

匿名 (未验证) 提交于 2019-12-02 22:09:29
开发时一定要用管理员模式打开VS或者VSCODE进行开发,同时不要在nuget上直接下载,要去github上下载源代码调试。第一方便调试,第二Surging迭代较快,nuget版本往往不是最新的。 问题:fail: Surging.Core.DotNetty.DotNettyServerMessageListener[0] 服务主机启动失败XXX 使用netstat -ano命令查看报错的端口是否被占用或者是不是当前vs权限不够,不够请用管理员模式打开 新版本中不要使用option.UseDotNettyTransport();该方法已过时,如果在Program中再调用的话会有冲突。 问题:Generic types are not valid arg_paramname_name 接口不支持泛型类型,就是说不能这么写 [ServiceBundle("api/{Service}")] public interface IOracleDBServcie : IServiceKey { Task<List<T>> Query<T>(string sql); Task<T> ExecuteScalar<T>(string sql); Task<int> Execute(string sql); } 要写成这样,这还是挺坑的,不同的查询得定义不同的类型 [ServiceBundle(

Linux CentOS下部署Java Web项目

匿名 (未验证) 提交于 2019-12-02 21:59:42
本文讲解如何在Linux CentOS下部署Java Web项目的步骤。 一、环境准备: (1)Linux CentOS (2)apache-tomcat-9.0.10 (3)XShell 二、启动tomcat 1、启动Tomcat 进入 apache-tomcat-9.0.10 下的 bin 目录下 输入: ./catalina.sh start [ root@izuf6famz0x92jd98na1kiz bin ]# ./ catalina . sh start Using CATALINA_BASE : /usr/ local / tomcat / apache - tomcat - 9.0 . 10 Using CATALINA_HOME : /usr/ local / tomcat / apache - tomcat - 9.0 . 10 Using CATALINA_TMPDIR : /usr/ local / tomcat / apache - tomcat - 9.0 . 10 / temp Using JRE_HOME : /usr/ java / jdk1 . 8.0 _171 Using CLASSPATH : /usr/ local / tomcat / apache - tomcat - 9.0 . 10 / bin / bootstrap . jar