Yes, this is most likely related to namespace issues. For illustration issues, let's assume your server project's namespace is ServerApp
, and your client's namespace is ClientApp
. You define IModelData
in both applications, which means you have ServerApp.IModelData
and ClientApp.IModelData
. Even though the code is identical, these are two separate interfaces (because of the namespace).
So you're trying to pass ClientApp.IModelData
to the service, and it's expecting ServerApp.IModelData
.
You can solve this by moving the interface IModelData
to its own assembly and having the server app and the client app both reference this third assembly. That's what we do at work - all of our service contracts are in a separate assembly (two, actually, but that's a different story).
A couple of other things to note:
Unless your client is also hosting a service, you can remove the [ServiceContract]
attribute from the class. Clients don't need that.
In your server app, what is Server.Scraper = this;
for? It appears to be assigning the Form to a property Scraper
in the service, but I don't see that property in your code. Additionally, services don't really use properties (I think I saw somewhere that you could do it, but it wasn't intuitive). I don't think you'd want to assign the entire form to the service, as service's in and of themselves don't usually have UIs - they supply data and receive data from the service.