当前位置: 首页>>代码示例>>C#>>正文


C# IApplicationBuilder.UseSwaggerUi方法代码示例

本文整理汇总了C#中IApplicationBuilder.UseSwaggerUi方法的典型用法代码示例。如果您正苦于以下问题:C# IApplicationBuilder.UseSwaggerUi方法的具体用法?C# IApplicationBuilder.UseSwaggerUi怎么用?C# IApplicationBuilder.UseSwaggerUi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IApplicationBuilder的用法示例。


在下文中一共展示了IApplicationBuilder.UseSwaggerUi方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Configure

        /// <summary>
        /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        /// </summary>
        /// <param name="app"></param>
        /// <param name="env"></param>
        /// <param name="loggerFactory"></param>
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            var log = loggerFactory.CreateLogger<Startup>();
            try
            {
                loggerFactory.AddConsole(Configuration.GetSection("Logging"));
                loggerFactory.AddDebug();
                app.UseDeveloperExceptionPage();
                app.UseIISPlatformHandler();
                CheckAuthorization(app);
                app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
                app.UseMvc();
                app.UseSwaggerGen();
                app.UseSwaggerUi();
            }
            catch (Exception ex)
            {
                app.Run(
                        async context => {
                            log.LogError($"{ex.Message}");
                            context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                            context.Response.ContentType = "text/plain";
                            await context.Response.WriteAsync(ex.Message).ConfigureAwait(false);
                            await context.Response.WriteAsync(ex.StackTrace).ConfigureAwait(false);
                        });

            }
        }
开发者ID:Microsoft,项目名称:mattercenter,代码行数:34,代码来源:Startup.cs

示例2: Configure

 public void Configure(IApplicationBuilder app, IHostingEnvironment env)
 {
     app.UseStaticFiles();
     app.UseMvc();
     app.UseSwagger();
     app.UseSwaggerUi();
 }
开发者ID:lavbox,项目名称:TaskAPI.AspNet5,代码行数:7,代码来源:Startup.cs

示例3: Configure

 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
 {
     app.UseDefaultConfiguration();
     app.UseStaticFiles();
     app.UseSwaggerGen();
     app.UseSwaggerUi();
 }
开发者ID:MarcusParkkinen,项目名称:artist-lookup-service,代码行数:7,代码来源:Startup.cs

示例4: Configure

 public void Configure(IApplicationBuilder app)
 {
     app.UseMvc();
     app.UseSwagger();
     app.UseSwaggerUi();
     app.UseWelcomePage();
 }
开发者ID:herecydev,项目名称:WeatherTest,代码行数:7,代码来源:Startup.cs

示例5: Configure

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
		{
            loggerFactory.AddConsole(Configuration.GetSection("ConsoleLogging"));
            loggerFactory.AddDebug(LogLevel.Debug);
            
			// CORS
            app.UseCors((policy) => {
                policy.AllowAnyHeader();
                policy.AllowAnyMethod();
                policy.AllowAnyOrigin();
                policy.AllowCredentials();
            });

            app.UseExceptionHandling(option =>
           {
               // add your custom exception mappings here
           });
            
            // static files en wwwroot
			app.UseFileServer(new FileServerOptions() { EnableDirectoryBrowsing = false, FileProvider = env.WebRootFileProvider });
			app.UseStaticFiles(new StaticFileOptions { FileProvider = env.WebRootFileProvider });

			app.UseMvc(routes =>
			{
				routes.MapRoute(
					name: "default",
					template: "{controller=Home}/{action=Index}/{id?}");
				routes.MapRoute(
					name: "api",
					template: "api/{controller}/{id?}");
			});

            app.UseSwagger();
            app.UseSwaggerUi();  
		}
开发者ID:digipolisantwerp,项目名称:generator-dgp-web-aspnetcore_yeoman,代码行数:35,代码来源:Startup.cs

示例6: Configure

        // Configure is called after ConfigureServices is called.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.MinimumLevel = LogLevel.Information;
            loggerFactory.AddConsole();
            loggerFactory.AddDebug();

            // Add the platform handler to the request pipeline.
            app.UseIISPlatformHandler();

            // Configure the HTTP request pipeline.
            app.UseStaticFiles();

            // Add MVC to the request pipeline.
            app.UseMvc();
            // Add the following route for porting Web API 2 controllers.
            // routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");

            app.UseSwagger();
            app.UseSwaggerUi();

            // TOOD: Figure out oauth middleware to validate token
            //app.UseOAuthBearerAuthentication(opts =>
            //{
            //});
        }
开发者ID:mcliment,项目名称:Ahoy,代码行数:26,代码来源:Startup.cs

示例7: Configure

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("ConsoleLogging"));
            loggerFactory.AddDebug(LogLevel.Debug);
                       
			// CORS
            app.UseCors((policy) => {
                policy.AllowAnyHeader();
                policy.AllowAnyMethod();
                policy.AllowAnyOrigin();
                policy.AllowCredentials();
            });
            
            app.UseApiExtensions();

			app.UseMvc(routes =>
			{
				routes.MapRoute(
					name: "default",
					template: "api/{controller}/{id?}");
			});

            app.UseSwagger();
            app.UseSwaggerUi();
            app.UseSwaggerUiRedirect();
        }
开发者ID:digipolisantwerp,项目名称:generator-dgp-api-aspnetcore_yeoman,代码行数:26,代码来源:Startup.cs

示例8: Configure

        public void Configure(IApplicationBuilder app)
        {
            app.UseMvc();
            app.UseSwaggerGen();
            app.UseSwaggerUi();

            SampleData.Initialize(app.ApplicationServices);
        }
开发者ID:paulopez78,项目名称:voting,代码行数:8,代码来源:StartUp.cs

示例9: Configure

 public void Configure(IApplicationBuilder app)
 {
     app.UseCors("AllowAll");
     app.UseMvc();
     app.UseSwaggerUi("api");
     app.UseSwagger("{apiVersion}");
     app.UseWelcomePage();
 }
开发者ID:rzachariah,项目名称:hello-aspnet5,代码行数:8,代码来源:Startup.cs

示例10: ConfigureSwagger

        /// <summary>
        /// 
        /// </summary>
        /// <param name="application">The application.</param>
        private static void ConfigureSwagger(IApplicationBuilder application)
        {
            // Adds the swagger/{apiVersion}/swagger.json route.
            application.UseSwagger();

            // Adds the swagger/ui route.
            application.UseSwaggerUi();
        }
开发者ID:fmoliveira,项目名称:ASP.NET-MVC-Boilerplate,代码行数:12,代码来源:Startup.Swagger.cs

示例11: Configure

        // 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)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseMvc();
            app.UseSwagger();
            app.UseSwaggerUi();
        }
开发者ID:CNinnovation,项目名称:WindowsApps,代码行数:10,代码来源:Startup.cs

示例12: Configure

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
        {
            loggerFactory.MinimumLevel = LogLevel.Information;
            loggerFactory.AddConsole();

            app.UseMvcWithDefaultRoute();

            app.UseSwaggerGen();
            app.UseSwaggerUi();
        }
开发者ID:shirhatti,项目名称:MeetupDemo,代码行数:11,代码来源:Startup.cs

示例13: Configure

        public void Configure(IApplicationBuilder app)
        {
            app.UseDefaultFiles();
            app.UseStaticFiles();
            //app.UseIISPlatformHandler();
            //app.UseDefaultFiles();

            app.UseMvc();

            app.UseSwagger();
            app.UseSwaggerUi();
        }
开发者ID:Twiinlab,项目名称:FavoriteMoviesAngular,代码行数:12,代码来源:Startup.cs

示例14: Configure

        public void Configure(IApplicationBuilder app)
        {
            // Add the platform handler to the request pipeline.
            app.UseIISPlatformHandler();

            app.UseStaticFiles();

            app.UseMvc();

            app.UseSwaggerGen();
            app.UseSwaggerUi();
        }
开发者ID:andycmaj,项目名称:Ahoy,代码行数:12,代码来源:Startup.cs

示例15: Configure

        public void Configure(IApplicationBuilder app)
        {
            app.UseIISPlatformHandler();
			
			app.UseSwaggerGen();
			app.UseSwaggerUi();
			app.UseMvcWithDefaultRoute();

			app.Run(async (context) =>
            {
                await context.Response.WriteAsync("Hello World!");
            });
        }
开发者ID:mattridgway,项目名称:ASPNET5-SwaggerUI,代码行数:13,代码来源:Startup.cs


注:本文中的IApplicationBuilder.UseSwaggerUi方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。