Webactivator doesn't run on IIS 7
Asked Answered
C

1

6

I have several web applications that make use of packages using WebActivator. On my local machine with IIS 7.5 Express, everything works fine whether I test in Release or Debug configurations. However, on my production machine with IIS 7.5, WebActivator doesn't actually run, so all the modules fail to load and I have to add the code back into the Global.asax.cs file.

I'm stumped as to where to even begin looking - Googled and searched StackOverflow but haven't ran into anyone having similar issues. Is there anything explicit that needs to be configured to allow it to run?

Edit - Added quick sample of activator that logs to Windows. The function contents, when added to the Global.asax.cs file runs fine on the production server, but never logs from the activator.

using System.Web.Mvc;
using System;

[assembly: WebActivator.PreApplicationStartMethod(typeof(Admin.App_Start.WebActivatorTestStart), "Start")]

namespace Admin.App_Start
{
    public static class WebActivatorTestStart {
        public static void Start() {

            System.Diagnostics.EventLog log = new System.Diagnostics.EventLog();
            log.Source = ".NET Runtime";
            log.WriteEntry("WebActivator Start", System.Diagnostics.EventLogEntryType.Information);

        }
    }
}
Carmine answered 10/10, 2011 at 18:11 Comment(8)
Do you have ASP.NET 4 installed on your production machine?Peeples
Yup, same versions of everything between the dev and production boxes, except IIS 7.5/IIS Express 7.5. The app pool is set to .Net 4, integrated pipeline.Carmine
Are you sure it's WebActivator that doesn't run? Maybe it's whatever you're doing to load your modules that fails? Could you try to instrument the WebActivator to write to the log so you can verify that it's the WebActivator that fails?Eclectic
Just did - added a some quick code in the activator class to write to the Windows log. Same thing - on my dev machine the log entry shows up, nothing on the production machine. For reference, I included the test activator above.Carmine
I know it's a stab in the dark, but could you check if WebActivator dll is actually deployed to prod server and loaded into worker process?Eclectic
Checked and it is in the /bin folder on the server and at least in reflecting the AppDomain, it's loaded. I think my next step is to start with an absolute baseline solution with WebActivator on the server, then start adding everything back in, IoC, logging, db, etc, and see which one breaks it. Will post back in a few weeks, after vacation, if I find it.Carmine
Haha, yeah. Just haven't had time - keep getting more projects before the previous one is finished. Hopefully soon here I can take an afternoon and delve into it.Carmine
I have come across this same problem myself with a different set of circumstances: works on my workstation inside Cassini, works on IIS 7 on our server, doesn't work in IIS 7 on my workstation. I have fallen back to using System.Web.PreApplicationStartMethod directly to rule out a problem with WebActivator; and it still doesn't run so it appears its NOT (in my case) a WebActivator issue, but with the ASP.NET attribute itself. Interestingly, if I make the start method non-static, or incorrectly named, I do get an exception when starting the web app; so SOMETHING is going on...Anaheim
C
0

Well, I can't say for sure what I did to fix things, but it's working now.

A bit of history - I manage a number different large applications all using some common libraries. I have my common web library and that's where I used to have the IOC setup with Ninject and WebActivator. This base library had the App_Start folder in it. Maybe this was the reason? Dunno. Never got WebActivator to work with this setup so I just used the NinjectHttpApplication to handle registration and startup stuff. However, the base library still had a dependency on WebActivator (just no App_Start folder).

So now I'm working on refactoring some of the applications and the base libraries - clean up a bunch of code smell from the past few months. One step was to move all the IoC up to the actual web application - make the base libraries less monolithic. The base library no longer has any dependency on WebActivator.

And now it works. There also half a hundred other small changes I've made to the base library, so I apologize to others for not being more systematic about it.

Carmine answered 10/10, 2011 at 18:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.