无法使用Nancy Self Hosting运行System.Web.Optimization

有没有人有运气使用System.Web.Optimization与Nancy Self Hosting? 如果我注释掉“Styles.Render(”〜/ csspack / logincss“)。ToString()”视图工作正常。 如果我把它留在空白页面就会发送到浏览器。

这就是我的Razor配置的样子。

public class RazorConfig : IRazorConfiguration { public IEnumerable 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 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().AsSingleton(); container.Register(); .....bundle code... } 

这是我的观点。

 inherits Nancy.ViewEngines.Razor.NancyRazorViewBase @using Nancy.Helpers @using System.Web.Optimization      Log In @Html.Raw(Styles.Render("~/csspack/logincss").ToString())  .... more html .... 

我无法让这个工作,所以我最终切换到卡带。 http://getcassette.net/

在没有任何问题的情况下工作。 真的不需要改变太多。 看起来System.Web.Optimization从Cassette那里借了很多钱。

更新
在Linux上运行时,Cassette给了我奇怪的性能问题和错误。 我最终只是建立自己的。 https://github.com/donnyv/Nancy.BundleIt