Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebActivatorEx.PostApplicationStartMethod not working #32

Open
gpadvorac opened this issue Sep 4, 2017 · 9 comments
Open

WebActivatorEx.PostApplicationStartMethod not working #32

gpadvorac opened this issue Sep 4, 2017 · 9 comments

Comments

@gpadvorac
Copy link

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
Copy link
Owner

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

@gpadvorac
Copy link
Author

gpadvorac commented Sep 5, 2017 via email

@davidebbo
Copy link
Owner

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
Copy link

mkumara18 commented Oct 6, 2017

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
Copy link
Owner

@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
Copy link
Author

gpadvorac commented Oct 6, 2017 via email

@gpadvorac
Copy link
Author

gpadvorac commented Oct 6, 2017 via email

@mkumara18
Copy link

mkumara18 commented Oct 6, 2017

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

@mkumara18
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants