Monday, January 10, 2011

Why we got 404 when accessing WCF domain services deployed in IIS6

Symptom:
Customer deployed a Silverlight + ASP.Net Project in IIS6 of Windows Server 2003, and the application logic was encapsulated in domain services. In order to verify if the domain service was working or not, he typed an URL like blow:
http://serverName/ClientBin/<Namespace>-<Class_Name>.svc
We followed the steps of this article: http://timheuer.com/blog/archive/2009/12/10/tips-to-deploy-ria-services-troubleshoot.aspx. However, the issue still can't be fixed.
We got a workaround by creating an explicit svc file as below blog mentioned:
http://betaforums.silverlight.net/forums/p/180992/414301.aspx
But the question is:
Why it doesn't work if there is no explicit svc file for this scenario?

Root Cause:

After troubleshooting, we found that the 404 status code was caused that the option  "Verify that file exists" of .svc extension mapping of customer's web server was checked.
Under this situation, it will try to check if the file really exists in the physical disk when a request which extension is .svc was received on the web server. But actually, when we access the WCF RIA service through the URL like that: http://webserver/clientbin/<namespace>-<class_name>.svc, the file   doesn't really exist in the disk, unless we create it manually, that's why we got 404 status code which indicates "FILE NOT FOUND" information.

Solution:
Uncheck "Verify that file exists" for the .svc extension mapping

Read more:  AsiaTech: Learning by Practice