Try adding an Expires
header as well:
app.UseStaticFiles(new StaticFileOptions()
{
OnPrepareResponse = context =>
{
context.Context.Response.Headers.Add("Cache-Control", "no-cache, no-store");
context.Context.Response.Headers.Add("Expires", "-1");
}
});
Another approach would be to add a querystring that changes to the end of your requests in development. Middleware would not be required in this case.
<environment names="Development">
<link rel="stylesheet" href="https://stackoverflow.com/questions/38231739/~/lib/bootstrap/dist/css/bootstrap.css?@DateTime.Now.Ticks" />
<link rel="stylesheet" href="~/css/site.css?@DateTime.Now.Ticks" />
</environment>