• 1402/08/05

مشکل در minify شدن html :

سلام استاد وقت بخیر 
در پروژه از AddWebMarkupMin استفاده شده که در عکس میتوانید مشاهد کنید ولی متاسفانه html minify  نمیشه 
ولی یک چیز عجیب که در admin پروژه minify  میشه ولی در بقیه قسمت ها نه ممنون میشم راهنمایی کنید و در پروژه 
Web Application خام که میسازم همه چیز درسته ولی تمام مراحل را که مو به مو در پروژه خودم انجام میدم minify  نمیشه

صفحه اصلی 

و صفحه ادمین 

  • 1402/08/07
  • ساعت 08:42

سلام دوست من

لطفا تمامی کدهای فایل program.cs  و startup.cs رو ارسال کنین


  • 1402/08/08
  • ساعت 08:49
        public void ConfigureServices(IServiceCollection services)
        {
            #region config services

            services.AddControllersWithViews();
            services.AddScoped(typeof(IGenericRepository<>), typeof(GenericRepository<>));
            services.AddScoped<IUserService, UserService>();
            services.AddScoped<IAddressService, AddressService>();
            services.AddScoped<ISiteService, SiteService>();
            services.AddScoped<IBlogService, BlogService>();
            services.AddScoped<IPasswordHelper, PasswordHelper>();
            services.AddHttpClient<ICaptchaValidator, GoogleReCaptchaValidator>();
            services.AddScoped<ISmsService, SmsService>();
            services.AddScoped<IContactService, ContactService>();
            services.AddScoped<ISellerService, SellerService>();
            services.AddScoped<IExpertService, ExpertService>();
            services.AddScoped<IProductService, ProductService>();
            services.AddScoped<IOrderService, OrderService>();
            services.AddScoped<IResultCheckService, ResultCheckService>();
            services.AddScoped<ISellerWalletService, SellerWalletService>();
            services.AddScoped<ISiteWalletService, SiteWalletService>();
            services.AddScoped<IProductDiscountService, ProductDiscountService>();
            services.AddScoped<ILearningService, LearningService>();
            services.AddScoped<IPaymentService, PaymentService>();
            services.AddScoped<IViewRenderService, RenderViewToString>();
            services.AddRazorPages();
            services.AddWebMarkupMin(option =>
                {
                    option.AllowMinificationInDevelopmentEnvironment = true;
                    option.AllowCompressionInDevelopmentEnvironment = true;
                })
                .AddHtmlMinification()
                .AddHttpCompression()
                .AddXhtmlMinification();

            #endregion
         }
         
         
                 public void ConfigureServices(IServiceCollection services)
        {
            #region config services

            services.AddControllersWithViews();
            services.AddScoped(typeof(IGenericRepository<>), typeof(GenericRepository<>));
            services.AddScoped<IUserService, UserService>();
            services.AddScoped<IAddressService, AddressService>();
            services.AddScoped<ISiteService, SiteService>();
            services.AddScoped<IBlogService, BlogService>();
            services.AddScoped<IPasswordHelper, PasswordHelper>();
            services.AddHttpClient<ICaptchaValidator, GoogleReCaptchaValidator>();
            services.AddScoped<ISmsService, SmsService>();
            services.AddScoped<IContactService, ContactService>();
            services.AddScoped<ISellerService, SellerService>();
            services.AddScoped<IExpertService, ExpertService>();
            services.AddScoped<IProductService, ProductService>();
            services.AddScoped<IOrderService, OrderService>();
            services.AddScoped<IResultCheckService, ResultCheckService>();
            services.AddScoped<ISellerWalletService, SellerWalletService>();
            services.AddScoped<ISiteWalletService, SiteWalletService>();
            services.AddScoped<IProductDiscountService, ProductDiscountService>();
            services.AddScoped<ILearningService, LearningService>();
            services.AddScoped<IPaymentService, PaymentService>();
            services.AddScoped<IViewRenderService, RenderViewToString>();
            services.AddRazorPages();
            services.AddWebMarkupMin(option =>
                {
                    option.AllowMinificationInDevelopmentEnvironment = true;
                    option.AllowCompressionInDevelopmentEnvironment = true;
                })
                .AddHtmlMinification()
                .AddHttpCompression()
                .AddXhtmlMinification();

            #endregion

  • 1402/08/09
  • ساعت 13:06

سلام دوست من

سرویس ها رو 2 بار تنظیم کردین؟


  • 1402/08/09
  • ساعت 15:59
نه اشتباه شده 

        public static IHostBuilder CreateWebHostBuilder(string[] args) =>
           Host.CreateDefaultBuilder(args)
               .ConfigureWebHostDefaults(webBuilder =>
               {
                   webBuilder.UseStartup<Startup>();
                   webBuilder.UseNLog();
               });
               

 

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.Use(async (context, next) =>
            {
                await next();
                if (context.Response.StatusCode == 404)
                {
                    context.Response.Redirect("/Home/Error404");
                }
            });
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/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.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseWebMarkupMin();

            app.UseRouting();

            app.UseAuthentication();

            app.UseAuthorization();
                        app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "areas",
                    pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}"
                );

                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");

            });
            }

  • 1402/08/09
  • ساعت 22:38

احیانا از کش استفاده نکردین؟

احتمال میدم صفحه ی شما کش شده باشه


  • 1402/08/13
  • ساعت 18:05

نه فکر نکنم چون در web هم که publish کردم همینطور بود 


  • 1402/08/17
  • ساعت 08:46

در صورت امکان سورس کد پروژه و اسکریپت دیتابیس رو ارسال کنین برای بررسی