Common WCF Exception : Connection Unexpectedly Closed

后端 未结 12 1201
耶瑟儿~
耶瑟儿~ 2021-02-05 17:19

I have three projects. One is a WCF Services Project, one is a WPF Project, and one is a Microsoft Unit Testing Project. I setup the WCF Services project with a data object th

12条回答
  •  难免孤独
    2021-02-05 17:49

    As you yourself noted, if you mark the enum as DataContract, you'll have to mark the items, too.

    As an alternative you could just remove the [DataContract] before your enum like this:

    public enum Priority
    {    
      Low,    
      Medium,    
      High
    }
    

    This would work, too, because in this case WCF handles the enum by itself. If you mark it as [DataContract] you have to mark every item as you noticed yourself.

提交回复
热议问题