示例#1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app)
        {
            participantLibraryAppSettings = BootStrapParticipantLibraryAppSettings(app);

            var logWriter = new ParticipantLibraryLogger();

            BootStrapParticipantLibrary(logWriter);

            app.UseDeveloperExceptionPage();
            app.UseAppBuilder(appBuilder =>
            {
                // Some components will have dependencies that you need to populate in the IAppBuilder.Properties.
                // Here's one example that maps the data protection infrastructure.
                //appBuilder.SetDataProtectionProvider(app);
                //app.Map("/api/participantLibrary", partLibApp => partLibApp.UseParticipantLibraryCore(BootStrapParticipantLibraryAppSettings(app)));
                appBuilder.Map("/api/participantLibrary", partLibApp => partLibApp.UseParticipantLibraryCore(participantLibraryAppSettings, participantLibrary));
            });

            //app.UseWebApi();// UseStaticFiles();


            app.Run(ctx =>
            {
                //ctx.Response.Redirect("/index.html");
                return(Task.FromResult(0));
            });

            //var claimsPrincipalResolver = new ClaimsPrincipalResolver();

            //app.Run(async (context) =>
            //{
            //    await context.Response.WriteAsync("Hello World!");
            //});
        }
示例#2
0
        private static ParticipantLibraryAppSettings BootStrapParticipantLibraryAppSettings(IApplicationBuilder app)
        {
            var appSettings = app.ApplicationServices.GetService <IOptions <AppSettings> >();

            participantLibraryAppSettings = new ParticipantLibraryAppSettings()
            {
                CorsOrigins = appSettings.Value.CorsOrigins,
                IncludeErrorDetailPolicy = appSettings.Value.IncludeErrorDetailPolicy,
                ConnectionString_ParticipantLibrary_Read  = appSettings.Value.ConnectionString_ParticipantLibrary_Read,
                ConnectionString_ParticipantLibrary_Write = appSettings.Value.ConnectionString_ParticipantLibrary_Write,
                RabbitMqHostUri = appSettings.Value.RabbitMqHostUri,
                RabbitMqUser    = appSettings.Value.RabbitMqUser,
                SignalRNotificationServiceQueue = appSettings.Value.SignalRNotificationServiceQueue,
            };
            return(participantLibraryAppSettings);
        }