WCF web service error: The service cannot be activated because it does not support ASP.NET compatibility

后端 未结 4 1960
無奈伤痛
無奈伤痛 2021-02-01 12:28

I am trying to create a restful wcf web service. When I try to connect to the service through the client I get the following error:

4条回答
  •  忘掉有多难
    2021-02-01 12:59

    Actually, as per the latest documentation you need to do 2 things,

    1.For your service class:

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(Namespace = "url")]
    public class Service : IService
    {
    }
    

    2.For web.config

    
    
    

提交回复
热议问题