开发者

Error with WCF service marking the base type

开发者 https://www.devze.com 2023-03-17 11:24 出处:网络
Im getting this error consuming a WCF service: Type \'**\' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute.

Im getting this error consuming a WCF service:

Type '**' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute.

Consider marking the base type 'Microsoft.Window开发者_JAVA百科sAzure.StorageClient.TableServiceEntity' with DataContractAttribute or SerializableAttribute, or removing them from the derived type.

My Silverlight application is able to use it, but with MVC web app i get that error...

Can anyone help me solve this


It is hard to tell without more details of your implementation, but it sounds like a mismatch in how the class definitions are set up in each application. It might be that the silverlight app project has a reference to the Microsoft.WindowsAzure.StorageClient dll, but the other one does not, or it might be that they reference different versions and it is only marked as serializable in one of them. All data passed to / from a WCF service must be somehow serializable.

How are you sharing the class definitions for the data contract's base class and the inherited class between the WCF service and the 2 different applications? Can you post more details of the data contract that is causing the serialization error?


I checked the Microsoft.WindowsAzure.StorageClient dll and i have it in both projects.

I have this class implementation:

 public class Template : TableServiceEntity
    {
        public Template()
        {
            this.PartitionKey = string.Empty;
            this.RowKey = Guid.NewGuid().ToString();
        }(...)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号