locked
Error while creating ADO.NET data service RRS feed

  • Question

  •  

    Hi,

    I was using VS2008 SP1 to create ADO.NET data service. I created a Web site and included Northwind Entity Model. Then I created a Northwind data service. I enabed exception using [ServiceBehavior(IncludeExceptionDetailInFaults = true)]. When I run the Data service, I get the following error.

     

    The server encountered an error processing the request. The exception message is 'Exception has been thrown by the target of an invocation.'. See server logs for more details. The exception stack trace is:

    at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Data.Services.DataServiceConfiguration.InvokeStaticInitialization(Type type) at System.Data.Services.DataService`1.CreateConfiguration(Type dataServiceType, IDataServiceProvider provider, Object dataSourceInstance) at System.Data.Services.DataService`1.CreateProvider(Type dataServiceType, Object dataSourceInstance, DataServiceConfiguration& configuration) at System.Data.Services.DataService`1.EnsureProviderAndConfigForRequest() 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[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

     

    However When I use ASP.NET Dynamic data Futures sample, the data service works fine.

    I can also see that when I add a Northwind data service, the Svc file and .cs file were seperated and were not united. Namespace is not mentioned in .cs file

     

    Kindly help me how to overcome this error.

    Thanks in Advance.

    Wednesday, August 20, 2008 2:06 PM

Answers

  • Can you make sure that in the InitializeService method on your data service, you have given permissions to access your entity set?

     

    Basically, you should have this line in your InitializeService method:

     

    Code Snippet
    config.SetEntitySetAccessRule(
    "*", EntitySetRights.AllRead);

     

     

    Hope this helps.

     

    Thanks

    Pratik

    Thursday, August 21, 2008 10:37 PM
    Moderator

All replies

  • I've the same Problem...

     

    I've set [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)] 

    and     [DataServiceKey(new string[] { "NEHO_ID" })]

     

    and got the same error...

     

    Any ideas?

    Many thanks for all kind of hints...

     

    Thursday, August 21, 2008 3:52 PM
  • Can you make sure that in the InitializeService method on your data service, you have given permissions to access your entity set?

     

    Basically, you should have this line in your InitializeService method:

     

    Code Snippet
    config.SetEntitySetAccessRule(
    "*", EntitySetRights.AllRead);

     

     

    Hope this helps.

     

    Thanks

    Pratik

    Thursday, August 21, 2008 10:37 PM
    Moderator