Silverlight Hosting :: Pitfalls of Deploying Silverlight Applications in Web Farms

I wanted to make a few notes regarding my recent experience of deploying a Silverlight application in web farm environment. Here is what the topology looked like. It included load balancer appliance configured to redirect the traffic to one of three servers. There was also SQL Server cluster in active-passive configuration. The application was using 3 different databases. There was also SSRS component deployed on the same instance(s) of SQL Server, since Silverlight application included report viewer built using SSRS Report Viewer for Web Forms. The viewer was hosted in an ASPX page that contains SSRS Report Viewer. The page itself was hosted inside a Silverlight window that contained Telerik’s HtmlPlaceholder control.

The first problem that we encountered was MSDTC. We use TransactionScope to ensure transactional integrity of data updates. Unfortunately, since we have multiple databases in some updates, TransactionScope will automatically promote all transactions to MSDTC. We got errors from MSDTC right away. We had to configure MSDTC on each of the server in the SQL cluster. In cluster environment in Component Services you have to actually expand cluster node and configure MSDTC from there. You have to enable network access. We set it up with no authentication since all machines that participate in each transaction are not on the same domain, so configuring authentication for MSDTC would be pretty hard. We also had to configure MSDTC on all application servers that house our WCF services that Silverlight application is using. Event after all that MSDTC did not work. We also had to put exceptions into two different firewalls that production environment deployed. Once that was done, MSDTC finally worked.

The next set of errors came from report viewer. We kept getting invalid view errors. Of course, since I do not deploy production applications every month, I forgot about view state. Silverlight does not care about that, but SSRS Viewer does! So, first step was to synchronize machine keys for all web servers in our environment. You can read more about machine keys here. You can use this little program to generate keys on the fly. Once that was done, I was expecting SSRS to work. However, I was still getting errors. Again, it had everything to do with web farms. I forgot that I also need to synchronize session state. I had to configure web applications to use SQL Server based session state. First, you have to enable session state on an SQL Server you are going to use. You can use aspnet_regsql.exe tool that ships with .NET to do so. You can run it from any machine, and simply point to SQL Server. You can read about this tool in this article on MSDN. The last step is to update web.config files on all our web servers to looks similar to the following. Your syntax will vary depending on version of IIS you use and how your application pool is configured (classic or integrated pipeline mode) in IIS 7+. You can read more about the session node here. Here is an example of the configuration.

<sessionState
    mode="SQLServer"
    sqlConnectionString="data source=<SQL Server Name or IP address>;
        user id=<User ID>;password=<Password>"
    cookieless="false"
    timeout="20"
    />

Timeout is in minute. 20 minutes is the default, and you can change it if you would like.

OK, these are the steps we had to take to deploy the app. As always, I try to make notes my blog to document my experiences to hopefully make my next deployment task easier. I always encourage developers to maintain a blog for this exact reason. Your own blog becomes your personal knowledge base.

Comments are closed.

Sponsors

JaringanHosting.com

Cheap Reseller Hosting

Best Blog Hosting Provider

Best European ASP.NET 4.0 Hosting Provider