When you deploy a Silverlight application that uses an ADO.NET data service to a hosted service provider, you need to make some changes in order for the service to work properly. The following describes the steps I took to overcome the problems. Thanks to Phani Raj Yayavaram Narasimha, Mike Flasko, and Elisa Flasko at Microsoft for their help resolving these issues.
Modify Web.config in the Silverlight web application
Since the hosted server supports many different sites, it is necessary to tell your application which site is hosting your application. If you fail to do this, you will get an error similar to the following:
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
To do this, you need to add a “<baseAddressPrefixFilters>” element to the “<serviceHostingEnvironment>”. The highlighted text shows an example.
Modify the Service Reference in the Silverlight Code
You also need to change the service reference inside your Silverlight code to point to the service with an absolute address. Following is a sample that I used in my application:
Defining a Single Authentication Scheme
Your site must have one and only one authentication scheme. If you have more than one authentication scheme defined, you will get an error similar to the following:
IIS specified authentication schemes ‘Basic, Anonymous’, but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used.
I reduced my site’s authentication to “Anonymous” and everything worked great. The exact details on how you do this vary from ISP to ISP. I use DiscountASP.NET and I used the IIS MMC on the IIS 7 server hosting my site. You need to check with your ISP to determine how to do this on their hosting site.