Archive for the ‘.NET’ Category
Updated Weather Site
So I finally got around to updating my weather site, www.redfieldweather.com. It has been something I have been wanting to do for a while. I couldn’t update it for the longest time because my hosting provider didn’t want to install ASP.NET 4.0 until they made sure it was stable. They just got my site switched over to ASP.NET 4.0 this month.
My new site has a what I think is a cool Silverlight control that shows the current weather conditions. It is updated every 5 seconds so it should only be a few seconds behind what my weather station is showing at home. Now my next big challenge is to rebuild my weather computer. I get random crashes in the Virtual Weather Station software I use and that computer has been running pretty much non stop since I installed my weather station back in 2005.
I have completely changed the layout of the site as well so any comments would be greatly appreciated.
Current Weather Conditions Page
Shows the current weather conditions using the new Silverlight control and if there are any current weather alerts they will be right under the current conditions. Today’s current forecast is displayed right under that and then some basic almanac data is displayed.
Forecast
Shows the 6 day weather forecast
Weather Maps
Displays weather maps of the area and region including lightning strike data
I am sharing the objects I have created with anyone who wants to use them. You can download them from here: RedfieldWeather.zip These objects use the API-XML Feeds from Weather Underground. These objects are not yet complete. As I add more functionality and complete missing functionality I will update the file and my blog. By downloading and using these objects you agree to not hold Demiurge Software LLC liable. You use these objects freely and may redistribute them freely. I may also include the source code in later versions.
I currently don’t have any sample code on how to use them, but I will be working on that for a future post. Right now I just wanted to get the word out that the site has finally been updated.
UPDATED (3/14/2011): I have fixed the link to the RedfieldWeather.zip file.
ASP.NET SQL Session State in a Web Farm
I found out the hard way that storing session in a SQL server takes a little more work then most of the books that I have read talk about. Most articles don?t talk about what settings you should have when you are in a web farm. This article will hopefully point you in the right directions and keep you from the headaches that I had.
One of the first things to check is the easiest to fix. You will need to make sure you have a constant machine key between servers. The machine key is used for encryption and decryption of cookie data. Unless you set the machine key to a specific code on each machine they will use their own unique key, so when your connection switches from one server to the other server it can?t decrypt the data and you lose your session.
Microsoft has a couple articles on their site on how to create the machine keys and where to place them. You can place this machine key in your machine.config or web.config files.
-
312906 HOW TO: Create Keys by Using Visual C# .NET for Use in Forms Authentication
-
313091 HOW TO: Create Keys by Using Visual Basic .NET for Use in Forms Authentication
The other fix is a little more complicated to change and is less likely to be a problem for everyone. This problem happens when you add more web sites to one server then to the other server then you try to load balance two web sites. What happens is that the application path for the web sites is different on each server. For example on one server you have a web with an application path of \\LM\W3SVC\2 and on the other server it has an application path of \\LM\W3SVC\4. The problem is IIS uses the application path to store the data, and if they don?t match you will lose your session. You will have to synchronize the application path for the web sites on all your web servers in the web farm.
Microsoft has an article on this problem and how to fix it. If you think this is your problem please check out this article.
-
325056 PRB: Session State Is Lost in Web Farm If You Use SqlServer or StateServer Session Mode
When I was going through this we had both of these problems, and after running though these steps we are now using SQL session state on our web site, on a three server web farm.