YAFLogo

kheiser
  • kheiser
  • 74.2% (Friendly)
  • YAF Forumling Topic Starter YAF Version: 4
8 months ago
The re-index button in the host settings doesn't appear to be working for our forum.  New posts seem to be indexed without a problem, and I'm seeing data being saved to the Search_Data folder for that, but it doesn't look like the re-index is doing anything.  I checked the event log, and I don't see any new errors.  It looks like it should be creating a task in the task manager, but it doesn't look like the task is ever created.  I'm not sure if this is a bug in 4.0, or if it's an issue on my end.  I saw there was a user of a previous version that had an issue with tasks being created, but don't see anything obviously wrong in my startup.cs.  
YAF 4.x User
Sponsor
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
8 months ago
Did the search task is listed in the task manager, or is there any task in the task manager?

When the task is finished it creates a info message in the event log (when event log information is enabled the host settings).

kheiser
  • kheiser
  • 74.2% (Friendly)
  • YAF Forumling Topic Starter YAF Version: 4
8 months ago
Task manager is empty. I have info logs turned on, but nothing for the tasks is being logged. It doesn't appear that the task ever runs.
YAF 4.x User
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
7 months ago
There should be 5 tasks in the task manager.

Which means the code that inializes the task manager is missing from the startup file.

Can you post you startup.cs or compare it directly with the one from the sample application?

kheiser
  • kheiser
  • 74.2% (Friendly)
  • YAF Forumling Topic Starter YAF Version: 4
7 months ago
Where specifically in Startup does the task manager get initialized?
YAF 4.x User
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
kheiser
  • kheiser
  • 74.2% (Friendly)
  • YAF Forumling Topic Starter YAF Version: 4
7 months ago
​
        /// <summary>
        ///   Gets ServiceLocator.
        /// </summary>
        public IServiceLocator ServiceLocator => BoardContext.Current.ServiceLocator;

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure<CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies 
                // is needed for a given request.
                options.CheckConsentNeeded = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });



            services.AddSession(options =>
            {
                options.IdleTimeout = TimeSpan.FromMinutes(Globals.IdleTimeout);
                options.Cookie.HttpOnly = true;
                options.Cookie.IsEssential = true;
                
            });


            //services.AddControllers();
            services.AddControllers().AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null);
            //services.AddControllersWithViews();
            services.AddRazorPages();
            services.AddServerSideBlazor();
            //services.AddMemoryCache();


            services.AddSingleton<IWorker, Worker>();

            services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN");

            services.AddSignalR();

            services.AddYafCore(Globals.configuration);


        }


        /// <summary>
        /// Configures the container.
        /// </summary>
        /// <param name="builder">The builder.</param>
        public void ConfigureContainer(ContainerBuilder builder)
        {
            builder.RegisterYafModules();
        }


        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())   /// ***** Add this back when testing of error pages is done
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseSession();


            //app.UseStatusCodePages("text/plain", "Status code page, status code: {0}");

            app.UseStatusCodePagesWithReExecute("/StatusErrorPage", "?code={0}");
           // app.UseStatusCodePages("/StatusErrorPage?code={0}");

            app.UseHttpsRedirection();
            app.UseDefaultFiles();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseCookiePolicy();


            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
                endpoints.MapBlazorHub();
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}"
                    ); 
                endpoints.MapControllers();
                endpoints.MapYafHubs();
            });
            app.RegisterAutofac();
            app.UseAntiXssMiddleware();
            app.UseYafCore(this.ServiceLocator, env);
        }
I do have that call.  Here is relevant code from my startup.cs.  The only notable difference I'm seeing from the sample app is that I'm not calling AddYafRazorPages.  I've been adding the forum pages code directly to Areas/Forums/Pages, so I didn't think that was needed? 
YAF 4.x User
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
7 months ago
This cannot work. the order of the code is important. This should work...


        /// <summary>
        ///   Gets ServiceLocator.
        /// </summary>
        public IServiceLocator ServiceLocator => BoardContext.Current.ServiceLocator;

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure<CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies 
                // is needed for a given request.
                options.CheckConsentNeeded = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });



            services.AddSession(options =>
            {
                options.IdleTimeout = TimeSpan.FromMinutes(Globals.IdleTimeout);
                options.Cookie.HttpOnly = true;
                options.Cookie.IsEssential = true;
                
            });


            //services.AddControllers();
            services.AddControllers().AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null);
            //services.AddControllersWithViews();
            services.AddRazorPages();
            services.AddServerSideBlazor();
            //services.AddMemoryCache();


            services.AddSingleton<IWorker, Worker>();

            services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN");

            services.AddSignalR();

            services.AddYafCore(Globals.configuration);


        }


        /// <summary>
        /// Configures the container.
        /// </summary>
        /// <param name="builder">The builder.</param>
        public void ConfigureContainer(ContainerBuilder builder)
        {
            builder.RegisterYafModules();
        }


        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())   /// ***** Add this back when testing of error pages is done
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseSession();


            app.RegisterAutofac();
            app.UseAntiXssMiddleware();
            app.UseYafCore(this.ServiceLocator, env);


            //app.UseStatusCodePages("text/plain", "Status code page, status code: {0}");

            app.UseStatusCodePagesWithReExecute("/StatusErrorPage", "?code={0}");
           // app.UseStatusCodePages("/StatusErrorPage?code={0}");

            app.UseHttpsRedirection();
            app.UseDefaultFiles();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseCookiePolicy();


            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
                endpoints.MapBlazorHub();
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}"
                    ); 
                endpoints.MapControllers();
                endpoints.MapYafHubs();
            });
        }
kheiser
  • kheiser
  • 74.2% (Friendly)
  • YAF Forumling Topic Starter YAF Version: 4
7 months ago
That did it! Thanks so much for taking the time to look at the issue!
YAF 4.x User