views:

415

answers:

2

I'd like to implement a ADO.NET/WCF DataService and I am wondering what's the best way to setup a project in VS2008 SP1 for this purpose.

Currently I have an ASP.NET web application project (not of "WebSite" project type). The data access layer is an Entity model (EF version 1) with SQL Server database. I have the Entity Model in a separate DLL project and the web application project references to this assembly for all data accesses.

The ADO.NET/WCF DataService needs to communicate with the Entity model/database as well. It has to be hosted on the same web server (IIS 7.5) together with the web application.

Since the DataService is not directly related to that specific web application (though it will provide and modify data from/in the same database the web application uses as well) my basic idea was to separate the DataService in its own new project (which also references the Entity Model DLL).

Now I have seen that there is no project type "ADO.NET/WCF DataService" in VS2008 SP1. It seems only possible to add a DataService as an element to other existing projects, for instance Web Application projects.

Why isn't there a separate DataService project type? Does this mean now that I have to add the DataService as an element to my Web Application project? Or shall I create a new Web Application project and add a DataService to it? (I could delete the pregenerated default.aspx since I do not need any web pages in this project.) What's the best way?

Thank you for suggestions in advance!

+1  A: 

Since you are hosting your WCF services, you should use a Web Application Project for it. It can be hosted on a seperate site in IIS, where you can connect to using different web applications. There is no need for a seperate WCF DataService Project Template.

You get the following references like this:

Website --> WCF Service Website --> EM
Project (for the model)
WCF Service --> EM Project

Rody van Sambeek
Thanks for reply, Rody! In the meantime I've also found some information about the question (see my own answer here). For convenience I have started now to add the WCF DataService to my Web Application project.
Slauma
A: 

I believe this article (http://msdn.microsoft.com/en-US/library/cc668805.aspx) gives some important hints to the question. Especially the following quote might give the explanation why there is no separate project template for WCF DataServices:

ADO.NET Data Services are not standalone network services. An ADO.NET Data Service does not bind to and listen on a network socket for incoming requests to its representational state transfer (REST) entry points. Instead, an ADO.NET Data Service is a component hosted in an environment such as the Windows Communication Foundation (WCF) that provides core server networking facilities. The host handles direct interactions with the network and support caching, scalability, and authentication modules.

And the options to host a WCF DataService in a project seem to be:

  • ASP.NET application
ADO.NET Data Services can be hosted as a WCF endpoint inside an ASP.NET application. In this implementation, WCF and ASP.NET handle the network interaction for an ADO.NET Data Service.
  • or WCF ServiceHost or WebServiceHost
ADO.NET Data Services can be hosted using the WCF ServiceHost or WebServiceHost classes.
Slauma