This project is read-only.

VS2005 OK, Localhost No changes seen?

Feb 16, 2009 at 7:13 PM
Hi Everyone

I am a developer, and have installed the source, built it and run everything up OK. I then also setup IIS so that I could use it without going through VS2005.

I had already edited the initial blog and when I went through on localhost (and using the machine name) and saw the edited post.

However, I then changed the theme and made another edit, which I see fine in VS2005, but when I go to localhost or the machine name, I don't see those changes?

I have set the IIS folder to \BlogEngine.Web and the default document to default.aspx

Anyone help me out here ? - I know I could spend time on this, but I am really busy with work, and would like to use the blog
Feb 16, 2009 at 7:27 PM
This sounds like the classic 'caching' scenario in BE.  BE caches posts and settings like the theme (and other data too).  The cached data is stored in memory.  But when you make changes using VS2005's built-in web server, the changes are occurring within the built-in web server's application, and not within the application you setup in IIS (even though they're sharing the same files on disk).  So the application running within IIS isn't aware any changes have been made, so it continues to use the same data it has stored in memory.

Best thing to do is only use the IIS application -- which you can optionally do from VS2005.  In your VS2005 project, if you right-click on the project, 'Start Options' tab, under 'Server' select 'Use custom server' and for the Base URL, use the IIS url, eg. http://localhost/myblog/

A quick, manual fix to this would be to restart your application in IIS (or restart IIS).  Or you could make any change to the web.config file or any file in the App_Code directory (like just adding a space).  If you do this, the data cached in memory will clear out and the latest data will get read again.
Feb 16, 2009 at 7:41 PM
Thanks Ben

I get the picture

I had it as a virtual directory, so I re-started IIS. Then I saw the new edit. As an experiment, I then made some changes on localhost and as your post suggests these could not be seen by the browser fired up by VS2005. (since cassini will have its own session data)

Surely it must save the XML at some point - is there no way we can force it to do this? I assume it's being saved in session? I haven't had time to look at all the source, but if you pointed me at the right place, I expect I can overwrite the caching bit and make it flush to XML.

Certainly in my web apps that use XML as data, I constantly write to disk rather than cache.

Thanks again
Feb 16, 2009 at 7:58 PM
Edited Feb 16, 2009 at 7:58 PM
When you save the post (or any other setting), it is actually saved to disk at that point.  But BE isn't monitoring the disk for changes.  Other people have had problems with this when they try editing an XML file directly, but BE doesn't show the new information.  And others in web farms have struggled with this too where even though the XML files are mirrored on all the servers, IIS on the servers where the change was not made is still showing the old data.

Most of the data, like posts, are stored in static generic lists.  The Posts static list, for example, is in Post.cs in the BE core files ...

private static List<Post> _Posts;

And other things, like settings are stored in other generic lists.  I haven't tried anything personally ... but I'd imagine if you were to change it, you would want to monitor the file(s) for changes and then clear the static lists.  It may or may not be straight forward to change BE to do this.