Recently, my Windows 7 weather gadget started spontaneously saying that it “couldn’t connect to service”. This was odd, considering I’d configured this gadget years ago and hadn’t touched it since. If this is happening to you, here is how I fixed mine.
Apparently, the cause of the problem is that somehow my city name is changed from “Salt Lake City, UT” to “Salt Lake City, Utah”. I don’t know where this change is coming from or why the former works and the latter fails. However, I’ve come up with a quick
.BAT file that you can use to correct the problem when it occurs.
The weather gadget gets its configuration from
%LocalAppData%\Microsoft\Windows Sidebar\Settings.ini. In that file, you might see a couple lines like this:
WeatherLocationCode and the
WeatherLocation are used by the weather gadget to obtain and display the weather information. The code is used to do the search and the location text is used for display. I determined that this is the correct code for my city by searching weather.com for my city and observing that this code appears in the URL. I simply copy/pasted it from the URL.
If you google around for this problem, you will see people describing a fixup for the weather gadget that involves opening and saving, without modification, the file
%LocalAppData\Microsoft\Windows Live\Services\Cache\Config.xml. I too found this necessary, but it can only be done when the gadget program,
sidebar.exe is not running because it keeps this file open during execution. Taking all of this together, my solution is to:
- Stop the currently running
- Copy the two above mentioned files from known good copies.
I do this with the following batch file:
taskkill /f /im sidebar.exe /t cd "%LocalAppData%\Microsoft\Windows Sidebar" copy MySettings.ini Settings.ini cd "%LocalAppData%\Microsoft\Windows Live\Services\Cache" copy MyConfig.xml Config.xml start sidebar.exe pause
This solution assumes that you have saved off
MySettings.ini with known good data and simply made a copy of
MyConfig.xml. (Remember, the
Config.xml just needs to have its timestamp updated, the contents don’t need to be modified.)