jwerfel
jwerfel

Reputation: 31

Synchronize IIS web server configurations

We have multiple load balanced IIS web servers for our application backed by a MS SQL server database. We store application configuration information in the database. While the application is running I frequently change the configuration and the changes need to be propagated to the other web servers. Is there a good way to do this? I have been doing it through SignalR (to alert other servers a change has occurred and they should refresh their configuration) but SignalR is not always reliable and sometimes one server does not get the message. Is there a better solution?

Thank you

Upvotes: 3

Views: 1514

Answers (1)

Richard Szalay
Richard Szalay

Reputation: 84784

Updated

I now understand you to need to propagate an application level configuration change.

You could, as you mentioned, use SignalR. This would require having a central server that hosts the websocket connections, but has the benefit of being "instant".

Alternatively, if your requirements are simple, perhaps a short term in-memory cache would suffice.

If it's complex than that, I'd recommend looking into event queues (MSMQ, RabbitMQ). In this model, the instance changing the configuration publishes an event to the queue which can be consumed by the other instances on a background thread.

Original Answer

Microsoft Web Deploy was built to do this. It supports synchronizing sites across servers, even down to application pool settings and SSL certificates.

The IIS documentation site has a specific page that is relevant to your use case: Synchronize IIS.

There is a lot involved in configuring Web Deploy so I won't attempt to explain it all here, but for posterity reasons the command to sync a local site to a remote machine would be:

msdeploy.exe -verb:sync 
             -source:apphostconfig="Default Web Site" 
             -dest:apphostconfig="Default Web Site",computername=Server1

(The command was split over multiple lines for readability)

As an an entirely alternative approach, you could also use a "pull configuration" system like Powershell Desired State Configuration or Chef.

Upvotes: 1

Related Questions