Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            Console.WriteLine(ComFunc.GetApplicationRoot());
            //准备框架环境参数
            GlobalCommon.Logger             = new Log4Net();
            GlobalCommon.ExceptionProcessor = new EWRAExceptionProcessor();
            Console.OutputEncoding          = Encoding.UTF8;

            //设定服务端参数
            //设定监听端口
            if (!String.IsNullOrEmpty(MyConfig.GetConfiguration("Server", "Port")))
            {
                defaultport = MyConfig.GetConfiguration("Server", "Port");
            }
            else if (args != null)
            {
                if (args.Length > 0 && IntStd.IsInt(args[0]))
                {
                    defaultport = args[0];
                }
            }
            Console.WriteLine($"服务器启动监听端口为{defaultport},如果要调整,请在启动应用时,后面接端口参数,或者在appsettings.json中的Server下设定Port参数(配置档优先)");
            var host = new WebHostBuilder()
                       .UseKestrel()
                       .UseContentRoot(Directory.GetCurrentDirectory())
                       .UseUrls("http://*:" + defaultport)
                       .UseIISIntegration()
                       .UseStartup <Startup>()
                       .UseApplicationInsights()
                       .Build();

            host.Run();
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            var options = FrameDLRObject.CreateInstance();

            //Logic参数设定
            options.BusinessAssemblyName = "RestAPISample";
            options.WeixinHome           = "weixinhome";
            //EWRA自定义模块加载
            options.RestAPIModuleName = typeof(MyWebModule).FullName;
            //Logic参数设定
            options.RestAPILogicAssemblyName = "RestAPISample";
            //RestAPI模块启用定义
            options.RestAPILogicBaseType = typeof(MyRestLogic);
            //Tag模块启动定义
            options.TagAssembly        = "RestAPISample";
            options.RestAPIMainVersion = "v1.0";
            //默认起始路由
            options.DefaultStartRoute = MyConfig.GetConfiguration("Server", "DefaultStartRoute");
            //设置apidoc的路由
            options.APIDocRoute = MyConfig.GetConfiguration("Server", "APIDocRoute");
            //设置是否显示api doc
            options.IsShowRestAPIDoc = BoolStd.IsNotBoolThen(MyConfig.GetConfiguration("Server", "IsShowAPIDoc"), false);
            //设置中间件参数
            options.MiddleWareOptionsType = typeof(MyWebOptions);

            app.UseWeixinEWRAMiddleWare((FrameDLRObject)options);
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            GlobalCommon.Logger = new Log4Net();
            GlobalCommon.ExceptionProcessor = new WeixinExceptionProcessor();
            Console.OutputEncoding = Encoding.UTF8;

            //设定服务端参数
            //设定监听端口
            if (!String.IsNullOrEmpty(MyConfig.GetConfiguration("Server", "BindUrl")))
            {
                defaulturl = MyConfig.GetConfiguration("Server", "BindUrl");
            }
            else if (args != null)
            {
                if (args.Length > 0 && ComFunc.nvl(args[0]) != "")
                    defaulturl = args[0];
            }
            Console.WriteLine($"服务器启动绑定URL为{defaulturl},如果要调整,请在启动应用时,后面接端口参数,或者在appsettings.json中的Server下设定BindUrl参数(参数优先)");

            var host = new WebHostBuilder()
               .UseKestrel()
               .UseContentRoot(Directory.GetCurrentDirectory())
               .UseUrls(defaulturl)
               .UseIISIntegration()
               .UseStartup<Startup>()
               .UseApplicationInsights()
               .Build();

            host.Run();
        }
Exemplo n.º 4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseStaticFiles();
            app.UseSession();
            var options = FrameDLRObject.CreateInstance();

            //Logic参数设定
            options.BusinessAssemblyName = "Web.Business";
            //Razor参数设定
            options.ExcuteFilePath = env.ContentRootPath;
            //起始页设定
            options.StartPage = MyConfig.GetConfiguration("EFFC", "FrameStartPage");
            app.UseWeixinGoMiddleWare((FrameDLRObject)options);
        }
Exemplo n.º 5
0
        // 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)
        {
            services.AddDistributedMemoryCache();

            services.AddSession(options =>
            {
                options.Cookie.Name = ".AdventureWorks.Session";
                var defaultseconds  = 1800;
                if (IntStd.IsInt(MyConfig.GetConfiguration("EFFC", "SessionTimeOut")))
                {
                    defaultseconds = IntStd.ParseStd(MyConfig.GetConfiguration("EFFC", "SessionTimeOut")).Value;
                }
                options.IdleTimeout = TimeSpan.FromSeconds(defaultseconds);
            });
        }
Exemplo n.º 6
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseStaticFiles();
            //app.UseSession();
            var options = FrameDLRObject.CreateInstance();

            //Logic参数设定
            options.BusinessAssemblyName = "Wechat.Business";
            //Razor参数设定
            options.ExcuteFilePath = env.ContentRootPath;
            //起始页设定
            options.StartPage  = MyConfig.GetConfiguration("EFFC", "FrameStartPage");
            options.WeixinHome = "weixinhome";
            //微信Web模块启用定义
            options.WeixinModuleName = typeof(MyWeixinWeb).FullName;
            options.WebModuleName    = typeof(MyWebGo).FullName;

            app.UseWeixinGoMiddleWare((FrameDLRObject)options);
        }