Пример #1
0
 public ParseData(IWSSendData sendData, //ICache cache,
                  IEquipment_status_logsRepository logsRepo, IBirdhouseRepository birdhouse, IEquipmentRepository equipment, ISMS sms, ICALL call, IWECHAT wechat)
 {
     _sendData = sendData;
     //_cache = cache;
     _equipment = equipment;
     _logsRepo  = logsRepo;
     _sms       = sms;
     _call      = call;
     _wechat    = wechat;
     _birdhouse = birdhouse;
 }
Пример #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IWSSendData sendData)
        {
            var serviceScopeFactory = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>();
            var serviceProvider     = serviceScopeFactory.CreateScope().ServiceProvider;

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseStaticFiles();
            app.UseRouting();
            app.UseCors("CorsTest");//其中app.UseCors()必须放在app.UseRouting()和app.UseEndpoints之间,不然还是解决不了问题。
            app.UseAuthorization();
            app.UseHttpsRedirection();
            app.UseCookiePolicy();
            //app.UseMvc();
            //app.UseSwagger();
            //app.UseSwaggerUI();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapControllerRoute("apiDefault", "app/[controller]/[action]");
                endpoints.MapAreaControllerRoute(
                    name: "api", "api",
                    pattern: "{api:exists}/{controller=Home}/{action=Index}/{id?}");
                //endpoints.MapRazorPages();
            });
            app.UseWebSockets();
            //app.MapWebSocketManager("/ws", serviceProvider.GetService<WSSendData>());
            //fetch.Start();
            _sendData = sendData;
            _sendData.Build();
        }