WCF library contract into WCF Application

69 views Asked by At

So, I'm new in WCF and haven't completely imagined how is it working.. I have a solution with several projects: EntityModelProject, WCFLibraryProject and WCFProject. WCFLibraryProject is between Entity and WCF Application. In WCFLibraryProject I described contract with all methods and data types WCFProject should use. (I mean WCFProject contract should be exactly the same). So is there a way to reference WCFProject contract to WCFLibraryProject contract?? - to use that somehow?? As I'm new code sample would be really helpful. Thanks A lot

1

There are 1 answers

0
kroonwijk On BEST ANSWER

Just add a a reference in the WCFProject to the WCFLibraryProject in order for the interfaces you defined to be exposed as the endpoints of WCFProject. The only thing the WCFProject should contain itself is a WCFProject.svc file to physically access your service.

According to http://msdn.microsoft.com/en-us/library/ms733766.aspx, the svc file could look like this:

<% @ServiceHost language="c#" Debug="true" Service="YourNameSpace.WCFLibraryProject" %>

Hosting this service in the default site of local IIS would show a html page with an access link to the metadata of your service at: http://localhost/WCFProject.svc.