WebActivator icon indicating copy to clipboard operation
WebActivator copied to clipboard

WebActivatorEx.PostApplicationStartMethod not working

Open gpadvorac opened this issue 7 years ago • 9 comments

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.

gpadvorac avatar Sep 04 '17 20:09 gpadvorac

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

davidebbo avatar Sep 05 '17 02:09 davidebbo

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

gpadvorac avatar Sep 05 '17 04:09 gpadvorac

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.

davidebbo avatar Sep 06 '17 02:09 davidebbo

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);
        }
    }
}

mkumara18 avatar Oct 06 '17 18:10 mkumara18

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

davidebbo avatar Oct 06 '17 18:10 davidebbo

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

Sorry.

Best Regards,

George

gpadvorac avatar Oct 06 '17 19:10 gpadvorac

I was never able to make this work.

Best Regards,

George

From: David Ebbo [mailto:[email protected]] Sent: Friday, October 6, 2017 2:00 PM To: davidebbo/WebActivator [email protected] Cc: George Padvorac [email protected]; Author [email protected] 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.

gpadvorac avatar Oct 06 '17 19:10 gpadvorac

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

mkumara18 avatar Oct 06 '17 19:10 mkumara18

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

mkumara18 avatar Oct 06 '17 21:10 mkumara18