本文整理汇总了C#中IServiceCollection.AddGlimpse方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceCollection.AddGlimpse方法的具体用法?C# IServiceCollection.AddGlimpse怎么用?C# IServiceCollection.AddGlimpse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServiceCollection
的用法示例。
在下文中一共展示了IServiceCollection.AddGlimpse方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConfigureServices
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddGlimpse();
// Add Entity Framework services to the services container.
services.AddEntityFramework()
.AddSqlServer()
.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
// Add Identity services to the services container.
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
// Add MVC services to the services container.
services.AddMvc();
// Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
// You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
// services.AddWebApiConventions();
// Register application services.
services.AddTransient<IEmailSender, AuthMessageSender>();
services.AddTransient<ISmsSender, AuthMessageSender>();
}
示例2: ConfigureServices
public void ConfigureServices(IServiceCollection services)
{
services.AddGlimpse()
.RunningAgentWeb()
.RunningServerWeb()
.WithLocalAgent();
}
示例3: ConfigureDebuggingServices
/// <summary>
/// Configure tools used to help with debugging the application.
/// </summary>
/// <param name="services">The services collection or IoC container.</param>
/// <param name="environment">The environment the application is running under. This can be Development,
/// Staging or Production by default.</param>
private static void ConfigureDebuggingServices(IServiceCollection services, IHostingEnvironment environment)
{
// Add the following services only in development environment.
if (environment.IsDevelopment())
{
// Add Glimpse to help with debugging (See http://getglimpse.com/).
services.AddGlimpse();
}
}
示例4: ConfigureServices
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
ConfigureSecurity(services);
var useGlimpse = Configuration.Get<bool>("Glimpse:Enabled");
if (useGlimpse)
{
services.AddGlimpse();
}
var useFeatureFolders = Configuration.Get<bool>("FeatureFolders:Enabled");
services.Configure<RazorViewEngineOptions>(o =>
{
o.ViewLocationExpanders.Add(new FeatureFolderLocationRemapper());
});
// Add framework services.
var connectionString = Configuration["Data:DefaultConnection:ConnectionString"];
services.AddEntityFramework()
.AddSqlServer()
.AddDbContext<DomainContext>(options =>
{
options.UseSqlServer(connectionString);
})
.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(connectionString));
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
// only allow authenticated users
//http://leastprivilege.com/2015/10/12/the-state-of-security-in-asp-net-5-and-mvc-6-authorization/
var defaultPolicy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
services.AddCors();
services.AddSingleton<LogFilter>();
//services.AddCors();
services.AddMvc().AddMvcOptions(
options =>
{
options.ModelBinders.Insert(0, new TrimmingSimpleTypeModelBinder());
options.Filters.Add(new AuthorizeFilter(defaultPolicy));
options.ModelMetadataDetailsProviders.Add(new HumanizerMetadataProvider());
}).AddFluentValidation();
// Add application services.
services.AddTransient<IValidatorFactory, MvcValidatorFactory>();
services.AddTransient<IEmailSender, AuthMessageSender>();
services.AddTransient<ISmsSender, AuthMessageSender>();
}
示例5: ConfigureServices
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddGlimpse();
services.Configure<SiteSettings>(settings =>
{
});
// Add MVC services to the services container.
services.AddMvc().AddJsonOptions(options =>
{
options.SerializerSettings.ContractResolver =
new CamelCasePropertyNamesContractResolver();
});
}
示例6: ConfigureServices
// This method gets called by the runtime. Use this method to add services to the container.
//public IServiceProvider ConfigureServices(IServiceCollection services)
public void ConfigureServices(IServiceCollection services)
{
//http://docs.asp.net/en/latest/security/data-protection/configuration/overview.html
//If you change the key persistence location, the system will no longer automatically encrypt keys
// at rest since it doesn’t know whether DPAPI is an appropriate encryption mechanism.
services.ConfigureDataProtection(configure =>
{
string pathToCryptoKeys = appBasePath + Path.DirectorySeparatorChar
+ "dp_keys" + Path.DirectorySeparatorChar;
// these keys are not encrypted at rest
// since we have specified a non default location
// that also makes the key portable so they will still work if we migrate to
// a new machine (will they work on different OS? I think so)
// this is a similar server migration issue as the old machinekey
// where we specified a machinekey in web.config so it would not change if we
// migrate to a new server
configure.PersistKeysToFileSystem(
new DirectoryInfo(pathToCryptoKeys)
);
//configure.ProtectKeysWithCertificate("thumbprint");
//configure.SetDefaultKeyLifetime(TimeSpan.FromDays(14));
///configure.
});
//services.TryAddScoped<IConfigurationRoot, Configuration>();
//http://blog.getglimpse.com/2015/11/19/installing-glimpse-v2-beta1/
bool enableGlimpse = Configuration.Get<bool>("DiagnosticOptions:EnableGlimpse", false);
if (enableGlimpse)
{
services.AddGlimpse();
}
//services.AddLocalization(options => options.ResourcesPath = "AppResources");
ConfigureAuthPolicy(services);
// we may need this on linux/mac as urls are case sensitive by default
//services.Configure<RouteOptions>(routeOptions => routeOptions.LowercaseUrls = true);
// Setup dependencies for cloudscribe Identity, Roles and and Site Administration
// this is in Startup.CloudscribeCore.DI.MS.cs
services.ConfigureCloudscribeCore(Configuration);
services.TryAddScoped<LogManager, LogManager>();
//services.Configure<MvcOptions>(options =>
//{
// // forces https
// // note that the home or root is still accessible non securely
// // only enable this if you have an ssl certificate installed and working
// //options.Filters.Add(new RequireHttpsAttribute());
// //options.ModelValidatorProviders.Add()
//});
//services.Configure<IdentityOptions>(options =>
//{
// options.Password.RequiredLength
//});
// we are adding this from Startup.CloudscribeCore.cs so it is not needed here
// Add MVC services to the services container.
//services.AddMvc();
// Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
// You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
// services.AddWebApiConventions();
//Autofac config
// var builder = new ContainerBuilder();
////Populate the container with services that were previously registered
//// it seems this depends on beta4
//builder.Populate(services);
//var container = builder.Build();
//return container.Resolve<IServiceProvider>();
}
示例7: Start
public static GlimpseServiceCollectionBuilder Start(IServiceCollection serviceProvider, bool autoRegisterComponents)
{
return serviceProvider.AddGlimpse(autoRegisterComponents);
}