我是 FubuMvc 的新手,我只是在一个小项目上玩弄它。
我有默认的 nuget 包 fubu 配置,并且我正在使用 Web 表单视图引擎:
public ConfigureFubuMVC()
{
// This line turns on the basic diagnostics and request tracing
IncludeDiagnostics(true);
// All public methods from concrete classes ending in "Controller"
// in this assembly are assumed to be action methods
Actions.IncludeClassesSuffixedWithController();
// Policies
Routes
.IgnoreControllerNamesEntirely().IgnoreControllerFolderName()
.IgnoreMethodSuffix("Html")
.RootAtAssemblyNamespace();
// Match views to action methods by matching
// on model type, view name, and namespace
Views.TryToAttachWithDefaultConventions();
// View Engine
this.Import<WebFormsEngine>();
}
我在站点根目录中创建了一个控制器和一个视图,如下所示:~/IndexController.cs
namespace MovieApp
{
public class IndexController
{
private MoviesDBEntities _db = new MoviesDBEntities();
public MovieIndexViewModel Index()
{
return new MovieIndexViewModel { Movies = _db.Movies.ToList() };
}
public class MovieIndexViewModel
{
public IEnumerable<Movie> Movies { get; set; }
}
}
}
以及随之而来的视图:~/Index.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" MasterPageFile="/Site.Master" Inherits="MovieApp.Index" %>
...
当我浏览到 ~/Index 时,它工作正常。
现在我想将我的控制器移动到一个新文件夹“电影”中。所以我移动了控制器和视图,并将控制器上的命名空间更改为 MoviesApp.Movies。当我导航到 ~/Movies/Index 时,它在我的 IndexController.Index() ActionMethod 中遇到断点,但随后显示 404。
有任何想法吗?