OData (WCF Data Service) with Subsonic 3

I am trying to use the WCF data service with Subsonic, but I encountered this error while trying to access my "service.svc". I have 2 projects, one of them is a class library (called "OData"), which has Subsonic t4 templates for generating classes for my table. Another ASP.NET MVC2 project that references the "OData" project.

Then I create a new WCF data service in my ASP.NET MVC project called "service.svc", points to my "TestDB" context created by Subsonic, which I got from the "OData" project. I am adding this attribute to my "service" class for this article: http://theruntime.com/blogs/jaykimble/archive/2008/11/18/quotsubsonicquot-for-services-found-subsonic-3--ado.net -data-services.aspx

This is what my service class looks like:

[System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)] 
public class Service : DataService<SymetraGivingDB>
{
   // This method is called only once to initialize service-wide policies.
   public static void InitializeService(DataServiceConfiguration config)
   {
      // 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.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
      config.SetServiceOperationAccessRule("*", ServiceOperationRights.AllRead);
      config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
   }
}

When I try to access http: //localhost/Service.svc , I get this error:

The request failed

.
: " " SymetraGivingDB ", IQueryable" ", .
, IQueryable IgnoreProperties , .'. . . . :

System.Data.Services.Providers.ReflectionServiceProvider.PopulateMetadata(IDictionary 2 knownTypes, IDictionary 2 childTypes, IDictionary 2 entitySets)
at System.Data.Services.Providers.BaseServiceProvider.PopulateMetadata()
at System.Data.Services.DataService
1.CreateProvider()
System.Data.Services.DataService 1.HandleRequest()
at System.Data.Services.DataService
1.ProcessRequestForMessage( messageBody)
SyncInvokeProcessRequestForMessage (Object, Object [], Object [])
System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke( instance, Object [], Object [] & )
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc & rpc)
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5 (MessageRpc & rpc)
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41 (MessageRpc & rpc)
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4 (MessageRpc & rpc)
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31 (MessageRpc & rpc)
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3 (MessageRpc & rpc)
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2 (MessageRpc & rpc)
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11 (MessageRpc & rpc)
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1 (MessageRpc & rpc)
System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

"", : Id/Name/Deleted, , "Id" .

, ?

.

+3
1

[IgnoreProperties ( "" )] , WCF. IList, T .

+1

Source: https://habr.com/ru/post/1763258/


All Articles