Error while creating the EDM

Error while creating the EDM

Postby javed » Mon 20 Dec 2010 09:46

I am creating an EDM from my oracle database. I also created a WCF data service to refer to the model and to use that in silverlight. But when I am trying to reference that service model or running in browser it is giving following error (Verbose enabled)

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(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType 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, IDataServiceMetadataProvider provider) at System.Data.Services.DataService`1.CreateProvider() 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[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

I also created a trace file "App_tracelog.svclog" but do not know how to attach that.
I am using latest DotConnect for oracle 6.00 version 6.00.69
javed
 
Posts: 7
Joined: Mon 20 Dec 2010 09:33

Postby AndreyR » Mon 20 Dec 2010 14:19

Could you please provide the underlying exception?
Please disable the Tools->Options->Debugging->Enable Just My Code check box.
Then go to Debug->Exceptions and enable the Common Language Runtime Exceptions check box.
After these manipulations you should be able to provide us some more details about the problem.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby javed » Tue 21 Dec 2010 05:15

Thanks for reply.
I followed the steps which you mentioned but I think it will not change anything. as I am getting the error when I am trying to add a webreference of the EDM (embeded into a WCF data service) to a silverlight project.

The error which it is showing now is
===============================================

There was an error downloading 'http://localhost:2741/WcfDataService2.svc'.
The request failed with HTTP status 400: Bad Request.
Metadata contains a reference that cannot be resolved: 'http://localhost:2741/WcfDataService2.svc'.
The remote server returned an unexpected response: (400) Bad Request.
The remote server returned an error: (400) Bad Request.
If the service is defined in the current solution, try building the solution and adding the service reference again.
===============================================
I rebuilt many times but to no avail.
When I am seeing the .svc file in the browser it is still giving the same error which I had posted in my first post.
I also have a .svclog file.How to attach that?
javed
 
Posts: 7
Joined: Mon 20 Dec 2010 09:33

Postby javed » Wed 22 Dec 2010 12:29

I noticed that I am getting this issue when I am trying to set entity access rule. like
Code: Select all
namespace WebApplication1
{
    public class WcfDataService1 : DataService
    {
        // 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("", EntitySetRights.All);
            // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
        }
    }
}


If I comment the line
Code: Select all
config.SetEntitySetAccessRule("", EntitySetRights.All);

Then it is working but then it is of no use as no entity is accessible. Please provide me some help what to do.
javed
 
Posts: 7
Joined: Mon 20 Dec 2010 09:33

Postby AndreyR » Thu 23 Dec 2010 10:43

I have sent a simple working example to the e-mail address you have provided in our forum profile.
Please let us know if the error persists using it, and make some modifications (if necessary) to reproduce the error.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby javed » Thu 23 Dec 2010 12:17

Thanks for the sample.

It got resolved now. The problem was I was passing null instead of a wild char while setting entity access rule. The correct code is
Code: Select all
config.SetEntitySetAccessRule("*", EntitySetRights.All); //Posted for the benefit of others
javed
 
Posts: 7
Joined: Mon 20 Dec 2010 09:33


Return to dotConnect for Oracle