. 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 class Service1:IService1