首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏跟着阿笨一起玩NET

    如何创建一个RESTful WCF Service

    // WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml"; [OperationContract Guid AddEmployee(Employee employee) { return Guid.NewGuid(); } [OperationContract public void UpdateEmployee(Employee employee) { return; } [OperationContract // WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml"; [OperationContract Guid AddEmployee(Employee employee) { return Guid.NewGuid(); } [OperationContract

    91110发布于 2018-09-19
  • 来自专栏dotnet & java

    WCF入门(8)

    FullTimeEmployee))] 3 [ServiceContract] 4 public interface IEmployeeService 5 { 6 [OperationContract ] 7 Employee GetEmployee(int id); 8 [OperationContract] 9 void SaveEmployee (Employee emp); 10 } ServiceKnownType 还是这种,但他用来可以用来修饰OperationContract,当用来修改Operation的时候,他只对当前Operation ServiceKnownType(typeof(FullTimeEmployee))] 4 [ServiceKnownType(typeof(PartTimeEmployee))] 5 [OperationContract ] 6 Employee GetEmployee(int id); 7 [OperationContract] 8 void SaveEmployee(Employee

    49440发布于 2018-08-24
  • 来自专栏技术博客

    菜菜从零学习WCF九(会话、实例化和并发)

    (IsOneWay=true)] void Clear(); [OperationContract(IsOneWay = true)] void AddTo (double n); [OperationContract(IsOneWay = true)] void SubtractFrom(double n); [OperationContract(IsOneWay = true)] void MultiplyBy(double n); [OperationContract(IsOneWay = true)] void DivideBy(double n); [OperationContract] double Result(); } n1, double n2); [OperationContract] double Multiply(double n1, double n2); [

    66130发布于 2018-09-11
  • 来自专栏明丰随笔

    WCF学习笔记 4

    get; set; } public string ReplyAction { get; set; } } 在我们定义的服务类型里面需要指定一组操作方法,这些操作方法要作为契约的一部分必须应用[OperationContract Name = "CalculatorService", Namespace = "http://www.ainote.cn")] public interface ICalculator1 { [OperationContract (Name = "AddDouble")] double Add(double x, double y); [OperationContract(Name = "AddInt")] int CalculatorCatract",CallbackContract=typeof(ICalculatorCallback))] public interface ICalculator { [OperationContract = "http://www.ainote.cn/CalculatorService/AddDoubleReply")] double Add(double x, double y); [OperationContract

    47120发布于 2019-08-29
  • 来自专栏明丰随笔

    WCF学习笔记 3

    [OperationContract] void insertEmp(Employee emp); 单工模式 单向通信应是指通信只在一个方向进行,即从客户端流向服务。 [OperationContract(IsOneWay=true)] void insertEmp(Employee emp); 双工模式 双工模式的特点是,无论使用单向消息发送还是请求/答复消息发送方式 SessionMode.Required, CallbackContract=typeof(IServiceDuplexCallback))] public interface IServiceClass { [OperationContract (IsOneWay = true)] void AddNumber(); } public interface IServiceDuplexCallback { [OperationContract

    50910发布于 2019-08-29
  • 来自专栏大内老A

    WCF版的PetShop之三:实现分布式的Membership和上下文传递

    ] 23: int GetNumberOfUsersOnline(); 24: [OperationContract] 25: string GetPassword(string username, string answer); 26: [OperationContract(Name="GetUserByName")] ] 31: string GetUserNameByEmail(string email); 32: [OperationContract] 33: string ResetPassword(string username, string answer); 34: [OperationContract] 35: ); 40: [OperationContract] 41: MembershipConfigData GetMembershipConfigData();

    92060发布于 2018-01-16
  • 来自专栏菩提树下的杨过

    jQuery调用RESTful WCF示例(GET方法/POST方法)

    person"></param> /// <param name="welcome"></param> /// <returns></returns> [OperationContract person"></param> /// <param name="welcome"></param> /// <returns></returns> [OperationContract person"></param> /// <param name="welcome"></param> /// <returns></returns> [OperationContract person"></param> /// <param name="welcome"></param> /// <returns></returns> [OperationContract person"></param> /// <param name="welcome"></param> /// <returns></returns> [OperationContract

    2.3K80发布于 2018-01-23
  • 来自专栏大内老A

    [WCF安全系列]消息的保护等级[下篇]

    1: [ServiceContract] 2: public interface IServiceContract1 3: { 4: [OperationContract] ProtectionLevel = ProtectionLevel.None)] 8: public interface IServiceContract2 9: { 10: [OperationContract 1: [ServiceContract] 2: public interface ICalculator 3: { 4: [OperationContract(ProtectionLevel = ProtectionLevel.Sign)] 5: double Add(double x, double y); 6: [OperationContract(ProtectionLevel (ProtectionLevel = ProtectionLevel.Sign)] 5: double Add(double x, double y); 6: [OperationContract

    1.6K80发布于 2018-01-16
  • 来自专栏dotnet & java

    年前辞职-WCF入门学习(5)

    [ServiceContract(Name = "IHelloService")] public interface IHelloServiceChanged { [OperationContract ServiceContract 特性用来定义类的名字,里面的OperationContract用来定义方法的名字,如果某天我们改变了方法的名字,又不想让客户端重新引用,只需要定义OperationContract

    26160发布于 2018-08-24
  • 来自专栏菩提树下的杨过

    当wcf遇到JSON ?

    项目中有一个wcf供jquery调用,wcf示例代码如下: /**////

    /// 测试 /// /// <returns></returns> [OperationContract 于是用UriTemplate起了个别名HelloWorld应付,如下: /**//// /// 测试 /// /// <returns></returns> [OperationContract = "text/plain"; return ms; } /**//// /// 测试 /// /// <returns></returns> [OperationContract

    1K50发布于 2018-01-23
  • 来自专栏技术博客

    一步一步学Linq to sql(十):多层架构MVC WCF Linq

    summary> /// 添加 or 修改 /// /// <param name="gb"></param> [OperationContract ///

    /// 获取所有信息 /// /// <returns></returns> [OperationContract /// /// 删除 /// /// <param name="ID"></param> [OperationContract /// /// <param name="ID"></param> /// <returns></returns> [OperationContract

    77420发布于 2018-09-11
  • 来自专栏大内老A

    WCF技术剖析之五:利用ASP.NET兼容模式创建支持会话(Session)的WCF服务

    3: { 4: [ServiceContract] 5: public interface ICalculator 6: { 7: [OperationContract ] 8: void Add(double x); 9: [OperationContract] 10: void Subtract(double x); 11: [OperationContract] 12: void Multiply(double x); 13: [OperationContract ] 14: void Divide(double x); 15: [OperationContract] 16: double GetResult

    1.1K100发布于 2018-01-16
  • 来自专栏技术小讲堂

    WCF中的集合类型

    namespace ContractInterface {     [ServiceContract] public interface IContractManager     {         [ OperationContract namespace ContractInterface {     [ServiceContract] public interface IContractManager     {         [ OperationContract ] List<Contract> GetContracts(); [OperationContract ] MyCollection<Contract> GetContract();    

    1.3K60发布于 2018-03-07
  • 来自专栏GreenLeaves

    WCF系列教程之WCF实例化

    ( SessionMode=SessionMode.Required ) ] public interface IPerCall { [OperationContract ] int AddMethod(int a, int b); [OperationContract] int AddMethod1(int a, int b); [OperationContract] string GetInstanceId();//获取实例Id [OperationContract] int GetInstanceCount(); //获取实例数 [OperationContract] int GetOperationCount(); //

    1K100发布于 2018-01-26
  • 来自专栏大内老A

    WCF技术剖析之五:利用ASP.NET兼容模式创建支持会话(Session)的WCF服务

    3: { 4: [ServiceContract] 5: public interface ICalculator 6: { 7: [OperationContract ] 8: void Add(double x); 9: [OperationContract] 10: void Subtract(double x); 11: [OperationContract] 12: void Multiply(double x); 13: [OperationContract ] 14: void Divide(double x); 15: [OperationContract] 16: double GetResult

    1.2K100发布于 2018-01-16
  • 来自专栏大内老A

    WCF后续之旅(9):通过WCF的双向通信实现Session管理[上篇]

    ] 6: TimeSpan Renew(); 7:  8: [OperationContract(IsOneWay = true)] 9: void OnSessionKilled(SessionInfo sessionInfo); 10:  11: [OperationContract(IsOneWay = true typeof(ISessionCallback))] 4: public interface ISessionManagement 5: { 6: [OperationContract ] 10: void EndSession(Guid sessionID); 11:  12: [OperationContract] 13: IList<SessionInfo> GetActiveSessions(); 14:  15: [OperationContract] 16: void

    1.1K80发布于 2018-02-07
  • 来自专栏技术小讲堂

    WCF中操作的分界于调用顺序和会话的释放操作分界实例停止

    上文中的契约定义可以被重新设计: [ServiceContract(SessionMode=SessionMode.Required)] public interface Box {     [OperationContract (IsInitiating=true,IsTerminating=false)]     void Open(int boxId);     [OperationContract(IsInitiating = false, IsTerminating = false)]     int GetTotalFrenchletter();     [OperationContract(IsInitiating

    1K60发布于 2018-03-07
  • 来自专栏张善友的专栏

    RESTful WCF

    Justin Smith 《Twitter WCF Client》 下面我们来看一个简单的例子: [ServiceContract] public interface IService {      [OperationContract ]      [WebGet]      string EchoWithGet(string s);      [OperationContract]      [WebInvoke]      string

    1K100发布于 2018-01-29
  • 来自专栏dotnet & java

    WCF 入门(19)

    OperationContract 修饰的Divide方法加上FaultContract特性修饰。表明这个方法可能会抛DivideByZeroFault。 public interface ICalculatorService { [FaultContract(typeof(DivideByZeroFault))] [OperationContract

    42230发布于 2018-08-24
  • 来自专栏pangguoming

    WCF 添加 RESTful 支持,适用于 IIS、Winform、cmd 宿主

    Apply [WebGet] to the operation contract to make it RESTful. e.g. public interface ITestService { [OperationContract for SOAP and XML [ServiceContract(Namespace = "http://test")] public interface ITestService { [OperationContract

    1.2K90发布于 2018-03-08
领券