本文整理汇总了C#中IApplicationBuilder.UseBrowserLink方法的典型用法代码示例。如果您正苦于以下问题:C# IApplicationBuilder.UseBrowserLink方法的具体用法?C# IApplicationBuilder.UseBrowserLink怎么用?C# IApplicationBuilder.UseBrowserLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IApplicationBuilder
的用法示例。
在下文中一共展示了IApplicationBuilder.UseBrowserLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
// Add static files to the request pipeline
app.UseStaticFiles();
// Add cookie-based authentication to the request pipeline
app.UseIdentity();
// Add the following to the request pipeline only in development environment.
if (env.IsEnvironment("Development"))
{
app.UseBrowserLink();
}
/* Error page middleware displays a nice formatted HTML page for any unhandled exceptions in the request pipeline.
* Note: ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production.
*/
app.UseErrorPage(ErrorPageOptions.ShowAll);
app.ConfigureSecurity();
//Configure SignalR
app.UseSignalR();
// Add MVC to the request pipeline
app.ConfigureRoutes();
MyShuttleDataInitializer.InitializeDatabaseAsync(app.ApplicationServices).Wait();
}
示例2: Configure
// Configure is called after ConfigureServices is called.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerfactory)
{
// Configure the HTTP request pipeline.
// Add the console logger.
loggerfactory.AddConsole(minLevel: LogLevel.Verbose);
// Add the following to the request pipeline only in development environment.
if (env.IsEnvironment("Development"))
{
app.UseBrowserLink();
app.UseErrorPage(ErrorPageOptions.ShowAll);
}
else
{
// Add Error handling middleware which catches all application specific errors and
// send the request to the following path or controller action.
app.UseErrorHandler("/Home/Error");
}
// Add static files to the request pipeline.
app.UseStaticFiles();
// Add MVC to the request pipeline.
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
SampleData.Initialize(app.ApplicationServices);
}
示例3: Configure
// Configure is called after ConfigureServices is called.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.MinimumLevel = LogLevel.Information;
loggerFactory.AddConsole();
// Configure the HTTP request pipeline.
// Add the following to the request pipeline only in development environment.
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseErrorPage(ErrorPageOptions.ShowAll);
}
else
{
// Add Error handling middleware which catches all application specific errors and
// send the request to the following path or controller action.
app.UseErrorHandler("/Home/Error");
}
// Add static files to the request pipeline.
app.UseStaticFiles();
// Add MVC to the request pipeline.
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
// Uncomment the following line to add a route for porting Web API 2 controllers.
// routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
});
}
示例4: Configure
/// <summary>
/// Configure the ASP.NET Application
/// </summary>
/// <param name="app">The Application Builder</param>
public void Configure(IApplicationBuilder app)
{
logger.Trace("Entering Configure");
if (WebConfiguration.Instance.DevelopmentMode)
{
logger.Trace("Enabling Development Mode");
app.UseErrorPage(ErrorPageOptions.ShowAll);
app.UseBrowserLink();
}
// Serve up the stuff in wwwroot
logger.Trace("Adding Static Files Serving");
app.UseStaticFiles();
// Add in ASP.NET Identity Framework
logger.Trace("Adding ASP.NET Identity Framework");
app.UseIdentity();
// Configure the ASP.NET MVC6 routes
logger.Trace("Adding ASP.NET MVC6");
app.UseMvc(routes =>
{
routes.MapRoute(name: "default",
template: "{area=Main}/{controller=Home}/{action=Index}/{id?}");
});
// Initialize the Application database
logger.Trace("Initializing the Database");
ApplicationDbContext.InitializeDatabaseAsync(app.ApplicationServices).Wait();
}
示例5: Configure
// Configure is called after ConfigureServices is called.
public async void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, MyHealthDataInitializer dataInitializer)
{
loggerFactory.MinimumLevel = LogLevel.Information;
loggerFactory.AddConsole();
loggerFactory.AddDebug();
// Configure the HTTP request pipeline.
// Add the following to the request pipeline only in development environment.
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage(options => options.EnableAll());
}
else
{
// Add Error handling middleware which catches all application specific errors and
// sends the request to the following path or controller action.
app.UseExceptionHandler("/Home/Error");
}
// Add the platform handler to the request pipeline.
app.UseIISPlatformHandler();
// Add static files to the request pipeline.
app.UseStaticFiles();
// Add MVC to the request pipeline.
app.ConfigureRoutes();
await dataInitializer.InitializeDatabaseAsync(app.ApplicationServices, Configuration);
}
示例6: Configure
// Configure is called after ConfigureServices is called.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.MinimumLevel = LogLevel.Information;
loggerFactory.AddConsole();
// Configure the HTTP request pipeline.
// Add the following to the request pipeline only in development environment.
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseErrorPage();
app.UseDatabaseErrorPage(DatabaseErrorPageOptions.ShowAll);
}
else
{
// Add Error handling middleware which catches all application specific errors and
// sends the request to the following path or controller action.
app.UseErrorHandler("/index.html");
}
// Add static files to the request pipeline.
app.UseStaticFiles();
// Add SignalR to the request pipeline.
app.UseSignalR();
// Add MVC to the request pipeline.
app.UseMvc();
app.ApplicationServices.GetRequiredService<PerformanceGenerator>();
}
示例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.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), @"Pictures")),
RequestPath = new PathString("/Pictures")
});
app.UseMiddleware<CatifyMiddleware>();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
示例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)
{
Console.WriteLine(Configuration["secretThing"]);
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment()) {
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
app.UseBrowserLink();
}
else {
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseIdentity();
// Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715
app.UseMvc(routes => {
routes.MapRoute(
name: "default",
template: "{*path}",
defaults: new { controller = "Home", action = "Index" }
);
});
// initialize sample data
SampleData.Initialize(app.ApplicationServices).Wait();
}
示例9: Configure
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
loggerFactory.AddConsole(LogLevel.Information);
}
else
{
app.UseStatusCodePagesWithReExecute("/Error/Status{0}");
app.UseExceptionHandler("/Error");
loggerFactory.AddConsole(LogLevel.Warning);
}
app.UseReact(config =>
{
config
.AddScript("~/Content/js/socialfeed.jsx")
.SetReuseJavaScriptEngines(false);
});
app.UseStaticFiles();
app.UseIdentity();
app.UseSession();
// All real routes are defined using attributes.
app.UseMvcWithDefaultRoute();
// This is really not ideal, need to figure out a better way to do this.
// Based off http://stackoverflow.com/a/30762664/210370
UrlHelperExtensions.HttpContextAccessor = app.ApplicationServices.GetRequiredService<IHttpContextAccessor>();
}
示例10: 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");
}
// Comment this line to NOT use index.html as the startup file. For example, when using Mvc.
app.UseDefaultFiles();
app.UseStaticFiles();
// Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715
// Uncomment this line to use Mvc as the startup route.
//app.UseMvc(routes =>
//{
//routes.MapRoute(
//name: "default",
//template: "{controller=Home}/{action=Index}/{id?}");
//});
}
示例11: Configure
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseIISPlatformHandler();
app.UseCookieAuthentication(options =>
{
options.AuthenticationScheme = "Cookies";
options.AutomaticAuthenticate = true;
options.AutomaticChallenge = true;
options.LoginPath = new PathString("/account/login");
});
app.UseCookieAuthentication(options =>
{
options.AuthenticationScheme = "External";
});
app.UseGoogleAuthentication(options =>
{
options.AuthenticationScheme = "Google";
options.SignInScheme = "External";
options.ClientId = "434483408261-55tc8n0cs4ff1fe21ea8df2o443v2iuc.apps.googleusercontent.com";
options.ClientSecret = "3gcoTrEDPPJ0ukn_aYYT6PWo";
});
app.UseClaimsTransformation(user =>
{
if (user.Identity.IsAuthenticated)
{
user.Identities.First().AddClaim(
new Claim("now", DateTime.Now.ToString()));
}
return Task.FromResult(user);
});
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
示例12: Configure
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
// Add the following to the request pipeline only in development environment.
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage(options =>
{
options.EnableAll();
});
}
else
{
// Add Error handling middleware which catches all application specific errors and
// sends the request to the following path or controller action.
app.UseExceptionHandler("/Home/Error");
}
// Add the platform handler to the request pipeline.
app.UseIISPlatformHandler();
app.UseStaticFiles();
app.UseIdentity();
app.UseMvc();
ApplicationDbContext.InitializeDatabaseAsync(app.ApplicationServices).Wait();
}
示例13: Configure
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseIISPlatformHandler();
app.UseStaticFiles();
//////////////////////////////////////
// Custom middleware: send an event to the EH after request
// have been processed
app.UseMiddleware<TrackerMiddleWare>();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
示例14: 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.UseDatabaseErrorPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseIdentity();
#region snippet_1
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
#endregion
SeedData.Initialize(app.ApplicationServices);
}
示例15: 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.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseIISPlatformHandler();
app.UseStaticFiles();
app.UseCookieAuthentication(options =>
{
options.AuthenticationScheme = "Cookies";
options.LoginPath = new Microsoft.AspNet.Http.PathString("/Account/Login");
options.AutomaticAuthenticate = true;
options.AutomaticChallenge = true;
});
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}