Question

I've added Cassette.Nancy to an existing Nancy web project. This works fine when I set CassetteNancyStartup.OptimizeOutput = true; but when this is set to false I get 404 on the unbundled resources.

Here's my set up.

I'm using the following packages:

  • Cassette.Nancy version="2.1.1"
  • Cassette version="2.4.1"
  • Nancy version="0.22.2"
  • Nancy.Owin version="0.22.2"
  • Nancy.Viewengines.Razor version="0.22.2"

The files are like so:

  • Content
    • file1.css
    • file2.css
  • Scripts
    • script1.js
    • script2.js

CassetteBundleConfiguration:

public class CassetteBundleConfiguration : IConfiguration<BundleCollection>
{
    public void Configure(BundleCollection bundles)
    {
        bundles.AddPerSubDirectory<StylesheetBundle>("Content");
        bundles.Add<ScriptBundle>("Scripts");
    }
}

in my _Layout.cshtml:

@{
    Bundles.Reference("Content");
    Bundles.Reference("Scripts");
}

@Bundles.RenderStylesheets()
@Bundles.RenderScripts()

And finally in Bootstrapper:

public Bootstrapper()
{
    CassetteNancyStartup.OptimizeOutput = false;
}

Like I say this works fine when CassetteNancyStartup.OptimizeOutput is set to true but when false each of the resources return a 404 like this one:

GET http://localhost:10005/_cassette/asset/Content/file1.css?cf7a7edf515a8184a0c53ec498c583cc64bb0e63 404 (Not Found) 

Any suggestions?

Was it helpful?

Solution

This issue was down to me not adding the Owin handler in the web.config. Adding this fixed it.

  <system.webServer>
    <handlers>
      <add name="Owin" verb="*" path="*" type="Microsoft.Owin.Host.SystemWeb.OwinHttpHandler, Microsoft.Owin.Host.SystemWeb" />
    </handlers>
  </system.webServer>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top