nancycassette

Cassette.Nancy unbundled files returning 404


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:

The files are like so:

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?


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>