Tuesday, April 13, 2010

Using RIA Services / WCF with multiple host headers

If you are using RIA Services or just plain old WCF you and you have more than one url that you use to access your website and use IIS 6 you will need to modify your web.config file.

In my example, I access the same IIS web site using two different host headers because I have a small web farm and I want to be able to check each server in the farm after a deployment, not just use the load balanced url.

This means that I have two urls, one for load balancing that everyone uses, and the one I use for testing to make sure a particular server in the farm is working.

In my case, I have http://myapp:8888 which everyone uses, and http://myapp:18888 I use to hit server one, http://myapp:28888 to hit server two, etc.

Here is the change I had to make to my web.config on the first server.

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" >
<add prefix="http://myapp:8888" />
<add prefix="http://myapp:18888" />

If you don’t do this, you may get errors about anonymous, security, bindings, communication, etc. This tends to fix a lot of these issues.

This is one of the better references I have found for getting RIA Services and WCF running under .Net 3.x, IIS 6, etc.

No comments: