I have a very strange problem.
I have a working WCF service.
[ServiceContract]
public interface IService
{
[OperationContract]
int AddResult(int result, string name);
[OperationContract]
int list(int count);
}
In another class I have the implementation of this service. And it works.
But when I change the method “list” like this:
[ServiceContract]
public interface IService
{
[OperationContract]
int AddResult(int result, string name);
[OperationContract]
List<string> list(int count);
}
When I add service reference from targeted project (it is a Windows Phone application) I receive several errors and warnings. The key idea of them is that the service cannot be loaded (or endpoints can not be loaded).
The difference between two methods is very small – List instead of int type. But it is crucial.
Why it is so? Why I can not use List?
did you try to encapsulate your List collection into a proxy class? You could try something like:
Also, take a look at this link, I think that it might be what you are looking for.
UPDATE
As per discussed on the comments section of this thread, the problem was not located in the WCF service itself, but on the client that was being generated in @user1460819 Windows Phone app.
This problem was solved after the WCF Service binding was changed to “basicHttpBinding”, the WCF reference on the client side was regenerated and the whole project was rebuilt.