我已经将Cassette.Nancy添加到现有的Nancy项目中。当我设置CassetteNancyStartup.OptimizeOutput = true;时,这很好,但是当设置为false时,我在未绑定的资源上得到了404。
这是我的装备。
我使用以下软件包:
这些文件如下:
CassetteBundleConfiguration:
public class CassetteBundleConfiguration : IConfiguration<BundleCollection>
{
public void Configure(BundleCollection bundles)
{
bundles.AddPerSubDirectory<StylesheetBundle>("Content");
bundles.Add<ScriptBundle>("Scripts");
}
}在我的_Layout.cshtml里
@{
Bundles.Reference("Content");
Bundles.Reference("Scripts");
}
@Bundles.RenderStylesheets()
@Bundles.RenderScripts()最后在Bootstrapper中
public Bootstrapper()
{
CassetteNancyStartup.OptimizeOutput = false;
}就像我说的,当CassetteNancyStartup.OptimizeOutput设置为true时,这很好,但是当false每个资源返回一个404时,就像下面这样:
GET http://localhost:10005/_cassette/asset/Content/file1.css?cf7a7edf515a8184a0c53ec498c583cc64bb0e63 404 (Not Found) 有什么建议吗?
发布于 2014-04-11 19:21:32
这个问题是由于我没有在web.config中添加Owin处理程序。加上这个修复了它。
<system.webServer>
<handlers>
<add name="Owin" verb="*" path="*" type="Microsoft.Owin.Host.SystemWeb.OwinHttpHandler, Microsoft.Owin.Host.SystemWeb" />
</handlers>
</system.webServer>https://stackoverflow.com/questions/23019295
复制相似问题