locked
Method Access Exception in Microsoft.Data.Services.dll RRS feed

  • Question

  • I'm using 5.6.3 version of Microsoft.Data.Services.dll, Microsoft.Data.Edm.dll, Microsoft.Data.OData.dll, Microsoft.Data.Services.Client.dll, and System.Spatial.dll. Here is what my service roughly looks like:

    [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]
    public partial class MyDataService : DataService<ObjectContext>
    {
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("MyMessages", EntitySetRights.WriteAppend);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
        }

        protected override ObjectContext CreateDataSource()
        {
            var context = ((IObjectContextAdapter)new MyEntities()).ObjectContext;     
            context.ContextOptions.ProxyCreationEnabled = false;     
            return context;
        }
    }

    Then somewhere between the calls of CreateDataSource and InitializeService, an exception is being thrown:

          Request Error

          The server encountered an error processing the request. The exception message is 'Attempt by method 'System.Data.Services.DataServiceBehavior..ctor()' to access method 'System.Data.Services.DataServiceBehavior.set_MaxProtocolVersion(System.Data.Services.Common.DataServiceProtocolVersion)' failed.'. See server logs for more details. The exception stack trace is:

       at System.Data.Services.DataServiceBehavior..ctor()

       at System.Data.Services.DataServiceConfiguration..ctor(IDataServiceMetadataProvider provider)

       at System.Data.Services.DataService`1.CreateConfiguration(Type dataServiceType, IDataServiceMetadataProvider provider, Boolean isInternallyCreatedProvider)

       at System.Data.Services.DataService`1.CreateProvider()

       at System.Data.Services.DataService`1.EnsureProviderAndConfigForRequest()

       at System.Data.Services.DataService`1.HandleRequest()

       at System.Data.Services.DataService`1.ProcessRequestForMessage(Stream messageBody)

       at SyncInvokeProcessRequestForMessage(Object , Object[] , Object[] )

       at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)

       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)

       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)

       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)

       at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

    Has anyone seen this or know what I should try next? Thanks!
    Friday, December 12, 2014 8:02 PM