Custom Middleware in Plugin isn't Invoking

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
2 anni tempo fa
I added startup class in nopcommerce plugin and inheriting it from INopStartup but its not invoking.

  /public class RedirectUrlStartUp : INopStartup
    {
        /// <summary>
        /// Configure the using of added middleware
        /// </summary>
        /// <param name="application">Builder for configuring a n application's request pipeline</param>
        public int Order => 10001;

        public void Configure(IApplicationBuilder application)
        {
            
        }

        public void ConfigureServices(IServiceCollection services, IConfigurationRoot configuration)
        {
        }
    }
2 anni tempo fa
When you look at the line above ConfigureServices are you seeing the other references ?

Here is my code that works fine

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Nop.Core.Infrastructure;
using Nop.Plugin.Apollo.Appointments.ViewEngine;
using System;
using System.Collections.Generic;
using System.Text;

namespace Nop.Plugin.Apollo.Appointments.ActionFilter
{
    public class Startup : INopStartup
    {
        /// <summary>
        /// Add and configure any of the middleware
        /// </summary>
        /// <param name="services">Collection of service descriptors</param>
        /// <param name="configuration">Configuration of the application</param>
        public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
        {
            //add object context
            services.Configure<MvcOptions>(congig => {
                congig.Filters.Add<ApolloActionFilter>();
            });

            services.Configure<RazorViewEngineOptions>(o =>
            {
                o.ViewLocationExpanders.Add(new CustomViewEngine());
            });

            // Add framework services.  
            services.AddMvc();
        }

        /// <summary>
        /// Configure the using of added middleware
        /// </summary>
        /// <param name="application">Builder for configuring an application's request pipeline</param>
        public void Configure(IApplicationBuilder application)
        {
        }

        public int Order
        {
            get { return int.MaxValue; }
        }

    }
}

Also no need to start a new thread https://www.nopcommerce.com/en/boards/topic/91927/startup-class-in-a-plugin-at-nop-440-not-called-up
2 anni tempo fa
I am working with nopcommerce version 4.0. its still not working for me. I want to catch Configure method on every http request.


public void ConfigureServices(IServiceCollection services, IConfigurationRoot configuration)
        {
            //add object context
            
            // Add framework services.  
            services.AddMvc();
        }

        /// <summary>
        /// Configure the using of added middleware
        /// </summary>
        /// <param name="application">Builder for configuring an application's request pipeline</param>
        public void Configure(IApplicationBuilder application)
        {
        }

        public int Order
        {
            get { return int.MaxValue; }
        }

    }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.