我的 wcf 数据服务正在使用自托管,当我尝试通过 simploe.odata.client 从 wcf 数据服务中检索数据时,它会抛出一个错误:内部服务器错误。wcf 数据服务代码:public class RFODataService : DataService<RFODBEntities>
{
public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule(typeof(DETAIL).Name, EntitySetRights.All);
config.SetEntitySetAccessRule(typeof(HEADER).Name, EntitySetRights.All);
}
}
自托管代码:`var currentAssembly = Assembly.GetAssembly(this.GetType()); if (currentAssembly == null) return "Assembly not found"; var types = currentAssembly.GetTypes().Where(w => w.IsClass && w.Namespace.Contains("DataServices")).ToArray();
for (int i = 0; i < types.Length; i++)
{
var svcHost = new DataServiceHost(serviceType, new Uri[] { new Uri(string.Format("http://localhost:{0}/", Port)) });
svcHost.Open();
}`
simple.odata.client 代码:`var client = new ODataClient("URL");
var detail = client.For("DETAIL").FindEntriesAsync();
string temp = detail.Result.ToString();
Console.Write(temp);`
麻烦我了,有人知道原因吗?