我已经跳了很多障碍,但是我仍然看到Nancy提供的默认404 iamge。
我已掌握了'project.json
,因此我可以使用project.json
文件中的以下块嵌入我的资源(包括/assets/views/index.html):
"buildOptions": {
"embed": [
"assets/**",
"Content/**",
"fonts/**",
"Scripts/bootstrap.js",
"Scripts/jquery-2.2.2.js",
"Scripts/mustache.js",
"favicon.ico"
//, "Scripts/**" - include this and build fails with errors in *.targets (!)
]
}
调试和查询程序集资源时确认了这一点。一切都好。
我的Bootstapper包含:
protected override void ConfigureApplicationContainer(TinyIoCContainer container)
{
DependencyResolver.ConfigureDependencies(container);
ResourceViewLocationProvider
.RootNamespaces
.Add(GetAssembly(), "<name to assembly>"); //embedded resource directory location
}
然而在我的IndexModule中:
public class IndexModule : NancyModule
{
public IndexModule()
{
Get("/", args => Response.AsFile("assets/views/index.html", "text/html"));
}
}
这什么都没有......我可以错过任何东西吗?它与.Net Framework一起运行良好