This project has moved and is read-only. For the latest updates, please go here.

Must Disable Browser Cache To View Self-Hosted Pages

Oct 21, 2013 at 12:49 AM
Edited Oct 21, 2013 at 12:53 AM
I'm a bit of a noob to Katana, and wondering if someone can help me, it's probably a simple thing but not sure what to do.

I'm running into a problem where I have to have the browser cache disabled in order to view any of my web pages. It works fine when I do, but if I have caching turned on I get 404's. Turn caching off and it works perfect again. And it's the same behavior in IE, Chrome and Firefox. Katana is being hosted in a windows console process.

What am I doing wrong?

Thanks for any help you can give me...
Oct 21, 2013 at 9:46 PM
What middleware and versions are you using? Which middleware component are are you specifically expecting to handle the request?
Oct 21, 2013 at 10:49 PM
I've got these referenced in my project, I think these are the ones you're asking about, I can give them all to you if you need them:
  • Microsoft.Owin.StaticFiles.dll (v.0.20.20220.88)
  • Microsoft.Owin.FileSystems.dll (v.0.20.20220.88)
WebStartup code looks like this:
public void Configuration(IAppBuilder appBuilder)
        {
            var staticFilesDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "www");
            appBuilder.UseStaticFiles(staticFilesDir);

            var config = new HttpSelfHostConfiguration("http://mymachine:12345");

            // JSON stuff
            config.Formatters.JsonFormatter.SerializerSettings.TypeNameHandling = TypeNameHandling.Auto;
            config.Formatters.JsonFormatter.SerializerSettings.Converters.Add(new StringEnumConverter());

            // DI   stuff
            config.DependencyResolver = new SelfHostedSimpleInjectorWebApiDependencyResolver(myContainer);

            // Web Api
            config.UserNamePasswordValidator = new WebApiValidator();
            config.Routes.MapHttpRoute(name: "DefaultApi", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional });
            appBuilder.UseWebApi(config);
        }
Thanks!
Oct 21, 2013 at 11:37 PM
Ah, don't use those old pre-release packages. Use these instead: https://www.myget.org/f/aspnetwebstacknightly/. Let me know if you still have any issues after updating.