WCF使用小例子
WCF使用小例子
using System.Runtime.Serialization; using System.ServiceModel; using MySpace; using System.ServiceModel.Channels; using System;namespace MySpace { [DataContract] public class Person { public Person() { } [DataMember(Name = "Name")] public string mName { get; set; } [DataMember(Name = "Age")] public int? mAge { get; set; } [DataMember(Name = "Single")] public bool? mIsSingle { get; set; } [System.Runtime.Serialization.OnDeserialized] void OnDeserialized(System.Runtime.Serialization.StreamingContext c) { mAge = (mAge == null ? 18 : mAge); } } [ServiceContract] public interface IService { [OperationContract] Person Method(Person dd); } public class Service : IService { public Person Method(Person dd) { return dd; } } class Program { static void Main(string[] args) { string Url = " Binding binding = new BasicHttpBinding(); ServiceHost host = new ServiceHost(typeof(Service)); host.AddServiceEndpoint(typeof(IService), binding, Url); host.Open(); ChannelFactory
龙腾一族至尊龙骑
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~