Webactivator doesn't run on IIS 7
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: WebAct开发者_如何学Civator.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);
}
}
}
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.
精彩评论