Windows communication framework client in web site projects

The Visual Studio Orcas beta1 supports generating and using WCF client in the ASP.Net web site projects.  From the platform point of view, ASP.Net wants to enable an user to build a web site without any Visual Studio tools. The feature to generate WCF client has been built with the same sprit.  With Visual studio, you can easily add a WCF client, but without it, you can create your own by creating a 'svcmap' file.  The 'svcmap' file will be processed by a build provider at the runtime to generate WCF client code, which will be compiled on the fly, so web site code could consume those classes.

However, that comes with a price.  Because the build provider hasn't been built into the 3.0 framework (it is added in 3.5 framework), so it becomes not possible to consume WCF this way in a project targetting 3.0 framework.  That is why we can create a WCF server with a 3.0 project, but couldn't consume it in the same project.  (Of couse, if you use svcutil tool, it is still valid to generate WCF client, and consume it in a 3.0 web site project.  But you have to do everything by hand.)

However, a build provider might work well to do some simple code generation.  It actually is not a good platform to geneate complex proxy code.  The problem is that it can either sucess without any message, or fail with one message string, so it becomes no way to output waring messages, if anything might be wrong.  That is why it could be difficult to figure out a problem in the WCF client in a web site project.  Using a web application project might be a better choice, or maybe I will add the same WCF client to a client project to see warning messages.

The svcmap file is also used in the client project, so it is actually easy to copy one from a client project to a web site project.  Metadata files pulled down from services are saved in individular xsd/wsdl files, and actually referenced by the svcmap file.  It is somewhat similar to the discomap file in a web reference in VS 8.  The svcmap file also contains code generation options.  Many options of the svcutil tool are supported.  However, those options are not supported in the beta 1 product.  Unlike the old web reference, default proxy works fine in most cases.  Sometime, it is necessary to adjust those WCF client options to get right proxy code, that is especially true when you consume a service built with old web service platform.