Base solution for your next web application
Open Closed

How and where to register a module #1427


User avatar
0
soulmate created

Hello, I upgraded v0.10. I noticed that module scanning was removed <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1167#issuecomment-229988957">https://github.com/aspnetboilerplate/as ... -229988957</a>

However, since I have a external module it is not clear for me how I can register this module explicity in the startup class. Is their any other method than using the DependsOn attribute? Something like modules.Add<MyOwnModule>();


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Please check this issue <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/774">https://github.com/aspnetboilerplate/as ... issues/774</a>. You can do it with PlugInFolders.

  • User Avatar
    0
    soulmate created

    Hi,

    since it is just a sngile module/ dll I dont want to use the complete folder path here (otherwise it would iterate through all dlls). Is it possible to just add one modul?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    In your case, another option would be AddTypeList method of PlugInSources,

    Try this in your ApplicationStart of global.asax just before Log4Net configuration,

    AbpBootstrapper.PlugInSources.AddTypeList(typeof(YourModuleName));
    

    you should also include Abp.PlugIns namespace for extension method,

    hope this helps,

  • User Avatar
    0
    soulmate created

    Hi, Thank you. I registered it like that and the module works. HOWEVER: After one minute I receive an exception in MethodInvocationValidator and my local website (IIS) crashes:

    Exception information: Exception type: HttpException Exception message: The client disconnected. at System.Web.Hosting.IIS7WorkerRequest.BeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state) at System.Web.HttpBufferlessInputStream.BeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state) at System.IO.Stream.<>c.<BeginEndReadAsync>b__43_0(Stream stream, ReadWriteParameters args, AsyncCallback callback, Object state) at System.Threading.Tasks.TaskFactory1.FromAsyncTrim[TInstance,TArgs](TInstance thisRef, TArgs args, Func5 beginMethod, Func`3 endMethod) at System.IO.Stream.BeginEndReadAsync(Byte[] buffer, Int32 offset, Int32 count) at System.IO.Stream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) at Microsoft.Owin.Host.SystemWeb.CallStreams.DelegatingStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) at System.IO.Stream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count) at System.IO.StreamReader.

    Here is the code of the module:

    [DependsOn(typeof(MyAppDataModule))]
        [DependsOn(typeof(MyAppApplicationModule))]
        [DependsOn(typeof(MyAppCoreModule))]
        [DependsOn(typeof(AbpHangfireModule))]
        public class TestModule : AbpModule
        {
            public ILogger Logger { get; set; }
    
            public override void Initialize()
            {
                IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
    
                Configuration.Settings.Providers.Add&lt;TestProxySettingProvider&gt;();
                Configuration.Settings.Providers.Add&lt;QutationServicesSettingProvider&gt;();
    
                if (System.Diagnostics.Debugger.IsAttached)
                {
                    Configuration.Auditing.IsEnabled = false;
    
                }
                
            }
    
    
            public override void PostInitialize()
            {
                base.PostInitialize();
    
                try
                {
                    JobDefinition jobDefinition = new JobDefinition(IocManager);
    
    
    
                    RecurringJob.AddOrUpdate("Provider Reminder offer 24 hours", () => jobDefinition.OfferReminderJobDefinition(24), Cron.Hourly(0));
                  
    
                }
                catch (Exception ex)
                {
                    Logger.ErrorFormat("Error in Test Module: {0}", ex);
                }
             
            }
        }
    

    I also published the version to Azure and after 1 minute the application pool crashes.

    the module worked without any troubles in the previsous version. Do you have any idea why this happen?