I need to move my site from one Windows 2008 + IIS 7 server to another. How can I workaround DNS cache problems (for some time DNS will resolve my host to old server). My old server will work for several days. May I tell IIS to redirect traffic somehow to a new server?
If you are moving a database as well, you will require downtime unless you can set up database replication.
1 ) Lower the TTL to e.g. 60 seconds on your DNS records.
2 ) Copy all site content to the new server, set it up to listen on several hosts, one of them being brand new. E.g. new.domain.tld. Also set up the server to respond with a 503 Service temporarily unavailable for around an hour or so, to make sure it has this status until DNS is fully updated everywhere. *
3 ) Set up a redirect from the old server to new.domain.tld. Make sure this is a 302 (temporary) and NOT a 301 (permanent) redirect.
* The reason for doing this is primarily search engines. They do not like duplicate content (seeing the same content on 2 sites) and it could give you penalties. You can still serve the site to the user, so people with browsers won't notice the difference. Search engines (And monitoring systems) will, however see that the resource is not available right now, so there is no reason for caching it.
If the sites are mirrored (they're exactly the same on both servers), and they use the same database/datasource, why don't you just leave it be while you wait for TTL do expire? :-)
If it is absolutely crucial that only one server hosts the site at a time, you could:
Route all requests to the new server, using Application Request Routing as explained here: http://www.iis.net/download/applicationrequestrouting , just set up a serverfarm on the old server and add the new server as the only one to the farm
Create a new, unique DNS record, and point it to the new server. Set up a secondary binding on the new site, so that it serves requests for both "www.website.com" and your new DNS entry: "new.website.com". Then set up a simple redirect on the old webserver to "new.website.com", so that even when people are sent to the old server because of cached DNS records, they will always be transfered to the new one.
Hope this helps :)