|
Thanks! But... I have a error in my mvc4 application.
System.NullReferenceException was unhandled by user code
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=MvcExtensions
StackTrace:
at MvcExtensions.Bootstrapper.Execute[TTask](IEnumerable`1 tasks) in d:\BuildAgent-02\work\5dc85169f18b1630\src\MvcExtensions\Bootstrapper\Bootstrapper.cs:line 176
at MvcExtensions.Bootstrapper.ExecuteBootstrapperTasks() in d:\BuildAgent-02\work\5dc85169f18b1630\src\MvcExtensions\Bootstrapper\Bootstrapper.cs:line 104
at MvcExtensions.ExtendedMvcApplication.Application_Start() in d:\BuildAgent-02\work\5dc85169f18b1630\src\MvcExtensions\ExtendedMvcApplication.cs:line 75
Call stack location: MvcExtensions.dll!MvcExtensions.ExtendedMvcApplication.Application_Start() Line 76
The file 'd:\BuildAgent-02\work\5dc85169f18b1630\src\MvcExtensions\ExtendedMvcApplication.cs' does not exist.
Looking in script documents for 'd:\BuildAgent-02\work\5dc85169f18b1630\src\MvcExtensions\ExtendedMvcApplication.cs'...
Looking in the projects for 'd:\BuildAgent-02\work\5dc85169f18b1630\src\MvcExtensions\ExtendedMvcApplication.cs'.
The file was not found in a project.
My code:
public class MvcApplication : UnityMvcApplication
{
public MvcApplication()
{
Bootstrapper.BootstrapperTasks
.Include<RegisterModelMetadata>()
.Include<RegisterControllers>()
.Include<RegisterRoutes>()
.Include<RegisterActionInvokers>();
}
public class RegisterRoutes : RegisterRoutesBase
{
public RegisterRoutes(RouteCollection routes)
: base(routes)
{
}
protected override void Register()
{
Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
Routes.MapRoute(
"Default",
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
public class RegisterServices : IModule
{
public void Load(IUnityContainer container)
{
container.RegisterType<IMyService, IMyService>(new PerRequestLifetimeManager());
}
}
Packages installed: Microsoft.Practices.ServiceLocation, Microsoft.Practices.Unity, MvcExtensions, MvcExtensions.Unity.
|