Using the Session in WCF

前端 未结 1 1553
失恋的感觉
失恋的感觉 2021-01-07 09:02

Here\'s what I\'m trying to do to use the Session in my WCF application:

 System.Guid guid = System.Guid.NewGuid();
 string id = guid.ToString()         


        
相关标签:
1条回答
  • 2021-01-07 09:15

    You will need to enable ASP.NET Compatibility Mode

    web.config

    <system.serviceModel>
      <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    </system.serviceModel>
    

    Your WCF services need to have the AspNetCompatibilityRequirementsAttribute set to Required or Allowed.

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class CalculatorService : ICalculatorSession
    
    0 讨论(0)
提交回复
热议问题