| hello wcf | |
| 大狗熊 | using System; using System.ServiceModel; using System.ServiceModel.Channels; using System.ServiceModel.Description; namespace WCFServer { [ServiceContract] public interface IBBSService { [OperationContract] string FindName(); } public class BBSService : IBBSService { public string FindName() { return "hello"; } } class Program { static void Main(string[] args) { ServiceHost host = new ServiceHost(typeof(BBSService), new Uri("http://localhost:8000/")); host.AddServiceEndpoint(typeof(IBBSService), new BasicHttpBinding(), "BBSService"); ServiceMetadataBehavior behavior = new ServiceMetadataBehavior(); behavior.HttpGetEnabled = true; host.Description.Behaviors.Add(behavior); host.Open(); Console.ReadLine(); host.Close(); } } } |
| 楼主 创建:08-04-20 00:12:32 更新:08-04-20 00:12:32 | |
| 发表回复 | |