无法获得system.web.optimization以使用nancy self hosting运行
题
有没有人使用system.web.用nancy self hosting的优化? 如果我评论出“styles.render(”〜/ csspack / logincss“)。ToString()”视图工作正常。 如果我将其保留在空白页面被发送到浏览器。
这就是我的剃刀配置的样子。
public class RazorConfig : IRazorConfiguration
{
public IEnumerable<string> GetAssemblyNames()
{
yield return "Microsoft.Web.Infrastructure";
yield return "WebGrease";
yield return "System.Web.Optimization";
yield return "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
}
public IEnumerable<string> GetDefaultNamespaces()
{
yield return "Microsoft.Web.Infrastructure";
yield return "WebGrease";
yield return "System";
yield return "System.Web";
yield return "System.Web.Optimization";
yield return "Nancy.ViewEngines.Razor";
}
public bool AutoIncludeModelNamespace
{
get { return false; }
}
}
.
我在初创公司中注册它。
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
container.Register<IRazorConfiguration, RazorConfig>().AsSingleton();
container.Register<RazorViewEngine>();
.....bundle code...
}
.
这是我的观点。
inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic>
@using Nancy.Helpers
@using System.Web.Optimization
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="utf-8" />
<title>Log In</title>
@Html.Raw(Styles.Render("~/csspack/logincss").ToString())
</head>
.... more html ....
. 解决方案
我无法完成工作,所以我最终切换到盒式磁带。 http://getcassette.net/
没有任何问题的大门。真的不必 变化很多。看起来像system.web.optimization从盒子中借了很多。
更新
Cassette在Linux上运行时,在Linux上呈现奇怪的性能问题和错误。
我最终建立了自己。 https://github.com/donnyv/nancy.bundleit
不隶属于 StackOverflow