Asp.net core Nancy使用.Net内核呈现嵌入式视图
我已经跳过了很多障碍,但我仍然看到南希默认的404图像。 我已经“掌握了”Asp.net core Nancy使用.Net内核呈现嵌入式视图,asp.net-core,nancy,.net-core,project.json,Asp.net Core,Nancy,.net Core,Project.json,我已经跳过了很多障碍,但我仍然看到南希默认的404图像。 我已经“掌握了”project.json,因此我可以使用project.json文件中的以下块嵌入我的资产(包括/assets/views/index.html): "buildOptions": { "embed": [ "assets/**", "Content/**", "fonts/**", "Scripts/bootstrap.js", "Scripts/jquery-2.2.2.j
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 (!)
]
}
这在调试和查询程序集资源时得到确认。一切都好
我的引导器包含:
protected override void ConfigureApplicationContainer(TinyIoCContainer container)
{
DependencyResolver.ConfigureDependencies(container);
ResourceViewLocationProvider
.RootNamespaces
.Add(GetAssembly(), "<name to assembly>"); //embedded resource directory location
}
这不意味着什么。。。我会错过什么吗?在.Net Framework中运行良好为什么您使用的是AsFile扩展名而不是AsHtml?为什么您使用的是AsFile扩展名而不是AsHtml?
public class IndexModule : NancyModule
{
public IndexModule()
{
Get("/", args => Response.AsFile("assets/views/index.html", "text/html"));
}
}