WCF RequirementsMode setting as 'Allowed' or 'Required'

来源:互联网 发布:板金放样展开图软件 编辑:程序博客网 时间:2024/06/05 17:13

. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode setting as 'Allowed' or 'Required'

 

 

when add a new .svc wcf service file, then published on IIS, brower this new file a error throw:

Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode setting as 'Allowed' or 'Required'

 

the AspNetCompatibilityRequirements  attribute on MSDN Info:获取一个值,该值指示此服务是否在 ASP.NET HTTP 应用程序管道的上下文中运行。(Gets a value that indicates whether this service is running in the context of the ASP.NET HTTP application pipeline)

 

how to fix it?

namespace WcfService1
{
    
[AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Required)]  // 添加这一句就OK了。
    
public classService1:IService1

 

0 0
原创粉丝点击