我在asp.net核心上使用了与hangfire的结构图,在应用程序上没有错误,但是即使数据已经在数据库上,也没有处理队列/调度任务.这是我的代码段配置
public IServiceProvider ConfigureServices(IServiceCollection services)
{
// setup automapper
var config = new AutoMapper.MapperConfiguration(cfg =>
{
cfg.AddProfile(new AutoMapperProfileConfiguration());
});
var mapper = config.CreateMapper();
services.AddSingleton(mapper);
// Bind settings parameter
services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
// Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
services.Configure<RouteOptions>(options => options.LowercaseUrls = true);
services.AddDbContext<DefaultContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddHangfire(options =>
options.UseSqlServerStorage(Configuration.GetConnectionString("DefaultConnection")));
services.AddMvc();
// ASP.NET use the StructureMap container to resolve its services.
return ConfigureIoC(services);
}
public IServiceProvider ConfigureIoC(IServiceCollection services)
{
var container = new Container();
GlobalConfiguration.Configuration.UseStructureMapActivator(container);
container.Configure(config =>
{
// Register stuff in container, using the …
Run Code Online (Sandbox Code Playgroud)