WebActivator PreApplicationStartMethod不起作用
我正在建设一个新项目。
我有一个名为“bootstrapper”的独立项目,它包含IOC和WebActivator。我的问题是包含WebActivator的类甚至没有在调试中加载! 可能是我错过了什么?
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(IocConfig), "RegisterDependencies")] public class IocConfig { public static void RegisterDependencies() { //.......... } }
您的Onion.Bootstrapper
项目对应于您的洋葱架构的最外层。 这是唯一引用所有其他项目的项目。
使用WebActivator
可以避免在WebApplication
引用Onion.Bootstrapper
。 RegisterDependencies
方法将在应用程序启动前调用。
要使其工作,您唯一需要做的就是确保将Onion.Bootstrapper
dll推送到WebApplication
/ bin目录((使用post build action或OutputTo nugget包很容易设置))。
- 通过运行asp.net mvc Web应用程序的IIS访问映射驱动器
- 如何使用对象上下文在Entity Framework中使用批量插入?
- 即使删除用户,ASP.Net Identity Identity.IsAuthenticated仍然是正确的
- 了解MVC-5身份
- 带有DI Simple Injector的log4net
- IEnumerable VS IList VS IQueryable
- 如何在asp mvc中清除指定控制器中的缓存?
- Visual Studio 2012 MVC构建错误:名称空间“System.Data.Entity”中不存在类型或命名空间名称“Infrastructure”
- 如何将MVC 5身份validation添加到Unity IoC?