// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { #region 自定义Session 这里使用了长连接,接入了其他服务,改成可以直接独立运行的版本。 //ShellSession.InitSession<RedisSession>(); //services.AddDiySession(c => //{ // c.GetDiySession<RedisSession>(); //}); //services.AddObject(TcpFrame.CreateServer(AppSettings.Get("ServerIp"), 888)); #endregion #region 自定义Session 独立运行版本,0.0.1 ShellSession.InitSession <CacheSession>(); services.AddDiySession(c => { c.GetDiySession <CacheSession>(); }); CacheSession.StartKeep(1); // 每秒一次自检测 #endregion services.AddResponseCompression(); services.AddAshx(o => { //o.IsAsync = true; o.JsonOptions = new()// System.Text.Json.JsonSerializerOptions(System.Text.Json.JsonSerializerDefaults.Web) { //IgnoreReadOnlyFields = true, Encoder = System.Text.Encodings.Web.JavaScriptEncoder.Create(System.Text.Unicode.UnicodeRanges.All), }; //o.JsonOptions.Converters.Add(JsonConverterHelper.GetDateConverter()); o.JsonOptions.Converters.Add(JsonConverterHelper.GetDBNullConverter()); });//注册api。 //.AddHttpContext();//注册静态方式的HttpContext对象获取。 services.AddObject(new UpLoad());//上传有关配置注册 }