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


C# IApplicationBuilder.UseDirectoryBrowser方法代码示例

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


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

示例1: Configure

        // <Services
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        // >Configure
        public void Configure(IApplicationBuilder app)
        {
            // Set up custom content types -associating file extension to MIME type
            var provider = new FileExtensionContentTypeProvider();
            // Add new mappings
            provider.Mappings[".myapp"] = "application/x-msdownload";
            provider.Mappings[".htm3"] = "text/html";
            provider.Mappings[".image"] = "image/png";
            // Replace an existing mapping
            provider.Mappings[".rtf"] = "application/x-msdownload";
            // Remove MP4 videos.
            provider.Mappings.Remove(".mp4");

            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\images")),
                RequestPath = new PathString("/MyImages"),
                ContentTypeProvider = provider
            });

            app.UseDirectoryBrowser(new DirectoryBrowserOptions()
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\images")),
                RequestPath = new PathString("/MyImages")
            });
        }
开发者ID:ColinDabritz,项目名称:Docs,代码行数:31,代码来源:StartupFileExtensionContentTypeProvider.cs

示例2: 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.
            String staticFilePath = env.WebRootPath + "\\static";
            // Add MyStaticFiles static files to the request pipeline.
            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(staticFilePath),
                RequestPath = new PathString("/static")
            });
            app.UseDirectoryBrowser();

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

            var logger = loggerFactory.CreateLogger("TestLogger");
            logger.LogDebug("Yay");
        }
开发者ID:ulkuniem,项目名称:CameraService-aforge-dnx,代码行数:29,代码来源:Startup.cs

示例3: ConfigurePrototype

        public void ConfigurePrototype(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseWelcomePage("/welcome");
            
            app.UseDeveloperExceptionPage();
            
            app.UseDirectoryBrowser(new DirectoryBrowserOptions()
            {
                FileProvider = new PhysicalFileProvider(@"E:\GitHub\Fan.Chinese.MVC\src\Fan.Chinese.MVC\Properties"),
                RequestPath = new PathString("/Properties")
            });

            app.UseStaticFiles();

            app.UseStatusCodePagesWithRedirects("/NotFoundPage.html");

            app.Run(async (context) =>
            {
                if (context.Request.Query.ContainsKey("throw")) throw new Exception("Exception triggered!");
                context.Response.ContentType = "text/html";
                await context.Response.WriteAsync($"<html><body><h2>Nihao {env.EnvironmentName}!</h2>");
                await context.Response.WriteAsync("<ul>");
                await context.Response.WriteAsync("<li><a href=\"/welcome\">Welcome Page</a></li>");
                await context.Response.WriteAsync("<li><a href=\"/Properties\">Browse Property Directory</a></li>");
                await context.Response.WriteAsync("<li><a href=\"/?throw=true\">Throw Exception</a></li>");
                await context.Response.WriteAsync("</ul>");
                await context.Response.WriteAsync("</body></html>");
            });

        }
开发者ID:misssoft,项目名称:Fan.Chinese.MVC,代码行数:30,代码来源:Startup.cs

示例4: Configure

 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app)
 {
     //   app.UseDeveloperExceptionPage();
     app.UseDefaultFiles();
     app.UseStaticFiles();
     app.UseDirectoryBrowser();
     app.UseMvc();
 }
开发者ID:AM636E,项目名称:FileBrowser,代码行数:9,代码来源:Startup.cs

示例5: 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();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            // app.UseDefaultFiles();

            // Code removed for brevity.

            // Set up custom content types -associating file extension to MIME type
            var provider = new FileExtensionContentTypeProvider();
            // Add new mappings
            provider.Mappings[".myapp"] = "application/x-msdownload";
            provider.Mappings[".htm3"] = "text/html";
            provider.Mappings[".image"] = "image/png";
            // Replace an existing mapping
            provider.Mappings[".rtf"] = "application/x-msdownload";
            // Remove MP4 videos.
            provider.Mappings.Remove(".mp4");

            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\images")),
                RequestPath = new PathString("/MyImages"),
                ContentTypeProvider = provider
            });

            app.UseDirectoryBrowser(new DirectoryBrowserOptions()
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\images")),
                RequestPath = new PathString("/MyImages")
            });

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

        }
开发者ID:crestin,项目名称:Docs,代码行数:53,代码来源:StartupFECTP.cs

示例6: Configure

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        #region snippet1
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseStaticFiles(); // For the wwwroot folder

            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\images")),
                RequestPath = new PathString("/MyImages")
            });

            app.UseDirectoryBrowser(new DirectoryBrowserOptions()
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\images")),
                RequestPath = new PathString("/MyImages")
            });
        }
开发者ID:MaherJendoubi,项目名称:Docs,代码行数:20,代码来源:StartupBrowse.cs

示例7: 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();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
           // app.UseDefaultFiles();
            // Code removed for brevity.

            app.UseStaticFiles();

            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), @"MyStaticFiles")),
                RequestPath = new PathString("/StaticFiles")
            });

            app.UseDirectoryBrowser(new DirectoryBrowserOptions()
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\images")),
                RequestPath = new PathString("/MyImages")
            });

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
开发者ID:crestin,项目名称:Docs,代码行数:41,代码来源:Startup.cs

示例8: 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();

            app.UseDefaultFiles();
            app.UseStaticFiles(new StaticFileOptions
            {
                ServeUnknownFileTypes = true,
                DefaultContentType = "text/plain",
            });

            app.UseDirectoryBrowser();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

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

示例9: Configure_FileServerFormatter

 public void Configure_FileServerFormatter(IApplicationBuilder app)
 {
     app.UseDirectoryBrowser(new DirectoryBrowserOptions()
     {
         Formatter = new Formatter()
     });
 }
开发者ID:pakrym,项目名称:signoffs,代码行数:7,代码来源:Startup.cs

示例10: Configure

 public void Configure(IApplicationBuilder app)
 {
     app.UseStaticFiles();
     app.UseDirectoryBrowser();
 }
开发者ID:guilin0522,项目名称:w3-learn,代码行数:5,代码来源:Startup.cs


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