我在 LINQ to SQL 数据上下文之上做一个简单的 WCF 数据服务。我的 svc.cs 文件非常简单。但是,当我从 VS2012 运行它时,我得到一个没有更多信息的通用“请求错误”。我该如何解决/解决它?
using System;
using System.Collections.Generic;
using System.Data.Services;
using System.Data.Services.Common;
using System.Linq;
using System.ServiceModel.Web;
using System.Web;
using MyApp.Business.Pmw.DataAccess;
namespace MyApp.DataService
{
public class SystemData : DataService<PmwModelDataContext>
{
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule("SysParam", EntitySetRights.ReadMultiple);
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
// Examples:
// config.SetEntitySetAccessRule("MyEntityset", EntitySetRights.AllRead);
// config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
}
}
}