Search code examples
c#.netwcfservice

WCF - Unable to send data


I've stumbled on a problem with WCF, I've setup a Console ServiceHost and its running as it should. When I request data from my client the request goes down the "pipe" and the server is starting to fetch the data from the database (successfully), it works all the way until it tries to send the data. The Client gets the response, no error message is received but the Array of Objects that should contain two entities is empty. I have no idea where to start to fix the problem. Do anyone have suggestions?

It has worked in the past and still do, in another solution. But when I copied over the files to this new solution it didn't work at all.


Solution

  • The solution was "hiding" inside the project containing the entities (both on the client side and the business side). The row that were missing was inside AssemblyInfo.cs. I had to specify which namespace that contained the Data Contract. Like this:

    [assembly: ContractNamespace("EntityNamespace", ClrNamespace = "SystemCreator.Business.Entities")]