2012-02-15 19 views
0

我一直在玩與周圍的XamlAsyncController,這是基於ASP.NET MVC 2,試了一下升級到MVC 3。然而,儘管原始應用工程確定,如果我嘗試運行它在MVC 3中,當試圖訪問ValueProvider時,我得到一個NullReferenceException。無法訪問ControllerBase.ValueProvider

我試着明確加載在Application_Start默認值提供:

protected void Application_Start() 
    { 
     AreaRegistration.RegisterAllAreas(); 

     ValueProviderFactories.Factories.Add(new RouteDataValueProviderFactory()); 
     ValueProviderFactories.Factories.Add(new FormValueProviderFactory()); 
     ValueProviderFactories.Factories.Add(new HttpFileCollectionValueProviderFactory()); 
     ValueProviderFactories.Factories.Add(new QueryStringValueProviderFactory()); 

     RegisterGlobalFilters(GlobalFilters.Filters); 
     RegisterRoutes(RouteTable.Routes); 

     BootstrapContainer(); 
    } 

我使用溫莎城堡3管理的IoC。有沒有人有任何想法爲什麼ControllerBase.ValueProvider將爲空?

回答

0

在我放棄了,嘗試了different project(呈現XAML作爲PNG圖像的視圖引擎)的端部。