davidebbo / WebActivator

Apache License 2.0
242 stars 49 forks source link

WebActivatorEx.PostApplicationStartMethod not working #32

Open gpadvorac opened 7 years ago

gpadvorac commented 7 years ago

First, I created a test WCF solution using VS 2017 and .net 4.7.

Next I added the required code as per these instructions: https://blog.falafel.com/start-code-using-webactivator-mvc-application/

And everything works as expected. Then I went to my production app which is a WPF app and WCF website on the backend. Once again I added similar code as instructed, but it wont execute. I also tried the PreApplicationStartMethod which doesn't execute. I even set the website as the startup project and created a Text.aspx page as the startup page. it will wont execute.

Any ideas what to do now?

Thanks.

davidebbo commented 7 years ago

So are you saying that it did work in the test WCF solution, but not your real solution?

gpadvorac commented 7 years ago

Yes. I created a new project/solution in VS 2017 using the c# WCF template. It worked fine there. Then I applied the same steps in an existing web project used for WCF, which, I think was originally created the same was at today’s test project.

Best Regards,

George

davidebbo commented 7 years ago

Sorry, it's hard to tell without seeing a repro. If you can isolate to a minimal repro you can share publicly on GitHub, maybe I can spot something there. Either that or look for potential differences in the startup logic for your working and non-working cases.

mkumara18 commented 7 years ago

Hi, I am trying to use WebActivatorEx in .NET class library and this class library is referenced in ASP.NET Web site application. Method start was never called and not sure why. Is it something to do with web site or am i missing something?

namespace Tst.Library.DI
{
    public static class NinjectBindings
    {
        public static void Initialize(IKernel kernel)
        {
            kernel.Load(new Assembly[] { Assembly.GetExecutingAssembly() });
        }
    }
}

[assembly: WebActivatorEx.PostApplicationStartMethod(typeof(Tst.Library.DI.AppEventsListener), "Start")]
namespace Tst.Library.DI
{
    using Tst.Library.DependencyInjection;
    public static class AppEventsListener
    {
        public static void Start()
        {
            NinjectBindings.Initialize(NinjectDIContainerProvider.Kernel);
        }
    }
}
davidebbo commented 7 years ago

@mkumara18 Can you format your comment per https://help.github.com/articles/basic-writing-and-formatting-syntax/? Very hard to read the code. Thanks!

gpadvorac commented 7 years ago

I don’t know, I was never able to make this work.

Sorry.

Best Regards,

George

gpadvorac commented 7 years ago

I was never able to make this work.

Best Regards,

George

From: David Ebbo [mailto:notifications@github.com] Sent: Friday, October 6, 2017 2:00 PM To: davidebbo/WebActivator WebActivator@noreply.github.com Cc: George Padvorac georgep@nwis.net; Author author@noreply.github.com Subject: Re: [davidebbo/WebActivator] WebActivatorEx.PostApplicationStartMethod not working (#32)

@mkumara18https://github.com/mkumara18 Can you format your comment per https://help.github.com/articles/basic-writing-and-formatting-syntax/? Very hard to read the code. Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/davidebbo/WebActivator/issues/32#issuecomment-334841934, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJlmkBn44piVmMCTb_OMCrxixGcaPOIdks5spniegaJpZM4PMPpN.

mkumara18 commented 7 years ago

Ok Sorry I have not used this as much. Formatted the code

mkumara18 commented 7 years ago

I tested this out and it works fine when application runs. I was trying to debug after that and thought it never loaded. Tested with throwing exception inside start method. Sorry for the confusion.

Thanks