There was an error downloading 'http://localhost:8732/Design_Time_Addresses/LegacyDataService/DataService/mex'. The request failed with HTTP status 400: Bad Request. Metadata contains a reference that cannot be resolved: http://localhost:8732/Design_Time_Addresses/LegacyDataService/DataService/mex.
After some head scratching and googling about the error I found out a post on MSDN forum where somebody was putting [DataMember] attribute over an indexer. I checked my [ServiceContract] and [DataContract]s.
My [ServiceContract] read as follows:
[ServiceContract] public interface IDataService { [OperationContract] IList<LegacyUser> GetUsers(); ...... ...... }
I tried to comment the IList<LegacyUser> stuff, but the error was still there. It then occurred to me that there was an Address property which returned build user's address by concatenating other fields. After this Address property was commented the error was gone.
Moral of the story is that:
- you should not put [DataMember] attribute on Indexers (as mentioned in MSDN post).
- you should not put [DataMember] attribute on properties that use other properties with the attribute to calculate return value.
No comments:
Post a Comment