日期:2014-05-18 浏览次数:20737 次
public class SchoolEntityService : DataService<SchoolEntities> { // This method is called only once to initialize service-wide policies. public static void InitializeService(DataServiceConfiguration config) { // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc. // Examples: config.SetEntitySetAccessRule("*", EntitySetRights.All); config.SetServiceOperationAccessRule("*", ServiceOperationRights.All); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } } static void Main(string[] args) { //定义服务 using (ServiceHost host = new ServiceHost(typeof(SchoolEntityService))) { host.Open(); Console.WriteLine("WCF服务已启动,按任意键退出!"); Console.ReadKey(); host.Close(); } }