OpenLightGroup Blog

rss

Blogs from OpenLightGroup.net


RIA Services - IIS6 Virtual Directory Deployment

A while back I made a post about using Windows Authentication with RIA Services and this post builds upon the topics discussed there. To further complicate the situation I needed to deploy a RIA services app to a Virtual Directory inside of a sub-folder in the IIS web root. To illustrate consider this URL pattern: https://intranet.companyname.com/division/applicationname

In this setup division is simply a file system folder inside of the root folder used by the IIS6 web site. Application name is an IIS6 Virtual Directory created under the division folder. For example: https://intranet.mycompany.com/accounting/costcalculator

When deploying to the virtual directory the Silverlight application spits out several 404 errors when looking for the auto-generated domain service .svc files.  After missing with the serviceModel configuration section for a while and getting nowhere, I decided to take a different approach based on some information found in this article about the WCF aspects of RIA services. In the article it states that if you create a  physical .svc file with the right name no virtual file with be created. It also talks about how URL rewriting is used to allow the virtual .svc file to appear to be in any folder in the site. This is were things break down in the configuration exampled above (or any virtual directory in IIS6 for that matter).

The work around I finally came to was create a physical file and drop it in the ClientBin folder with the .xap files. Because URL rewriting is not working, the .svc files and .xap files need to be in the same folder. In order to create the files you need to keep a few things in mind. The file needs to be named in this pattern: DomainServiceFullname.svc (be sure to replace all of the “.” with “-“ between namespaces and class name). Inside of the file needs to contain something similar to this:

<%@ ServiceHost 
 Service="ApplicationName.AnyAdditionalNamespaces.DomainService" 
 Factory="System.Web.Ria.Services.DomainServiceHostFactory"
%>

Now that you have the files name correctly, placed in the same folder and the xap and containing the correct service host information, you should now be able to deploy the application to the virtual directory.

If you continue to have problems please make sure you have read the article(s) mentioned above and use fiddler to help zero in on the issue. As always, please post your feedback or issues that you have and I will be happy to help anyway I can.





Comments are closed.