我主持南希在我的控制台应用程序,当我尝试调用一个视图(如“的login.html”)的页面给我的错误500这是代码:南希访问内部服务器错误
public sealed class LoginModule : NancyModule
{
private readonly DatabaseList _db = Singleton.DB;
public LoginModule()
{
Get["/"] = x => View["Login.html"];
}
}
我实现我自己的引导,因为我需要会话:
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
var directoryInfo = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;
if (directoryInfo != null)
Environment.CurrentDirectory = directoryInfo.FullName;
CookieBasedSessions.Enable(pipelines);
Conventions.ViewLocationConventions.Add((viewName, model, viewLocationContext) => String.Concat("Views/", viewName));
}
}
这是我的项目的树: 不同的路径;
- WebControllers/
- LoginModule.cs
- Nancy.cs
- 查看/
- 的login.html
我试着删除所有组合,删除CurrentDirectory,ViewLocationConventions,每类路径像/ Views /,../Views/等,但仍然没有。我也尝试把WebControllers中的视图路径,甚至只是Index.html文件,都没有。总之,我还尝试将Views重新命名为Login,无所事事。
要么改变查看[“的login.html”]查看[“的Index.html”]或重命名视图到Login.html – 2013-04-11 20:03:05
对不起,忘了提及,已经尝试过,同样的错误... – 2013-04-11 20:06:11
打开[南希诊断](https://github.com/NancyFx/Nancy/wiki/Diagnostics),看看是什么潜在的例外... – nemesv 2013-04-11 20:13:00