locked
WCF Data Service ERROR RRS feed

  • Question

  • Request Error

    The server encountered an error processing the request. The exception message is 'Tipo ObjectSpace corrispondente non trovato per il tipo 'AuthenticationModel.User'. Assicurarsi che ObjectContext o DbContext sia valido.'. See server logs for more details. The exception stack trace is:

       at System.Data.Services.Providers.ObjectContextServiceProvider.PopulateMetadata(IDictionary`2 knownTypes, IDictionary`2 childTypes, IDictionary`2 entitySets)   at System.Data.Services.Providers.BaseServiceProvider.PopulateMetadata()   at System.Data.Services.Providers.BaseServiceProvider.LoadMetadata()   at System.Data.Services.DataService`1.CreateMetadataAndQueryProviders(IDataServiceMetadataProvider& metadataProviderInstance, IDataServiceQueryProvider& queryProviderInstance, BaseServiceProvider& builtInProvider, Object& dataSourceInstance)   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)

    Any suggestion?

    Friday, July 27, 2012 9:48 AM

Answers

  • SOLVED: My entities are in separate aasambly...so

       protected override AuthenticationModelContainer CreateDataSource() {
                var authenticationModelContainer = new AuthenticationModelContainer("name=AuthenticationModelContainer");
                authenticationModelContainer.ContextOptions.ProxyCreationEnabled = false;
                authenticationModelContainer.MetadataWorkspace.LoadFromAssembly(typeof(User).Assembly);
                return authenticationModelContainer;
            }

    Friday, July 27, 2012 10:26 AM

All replies

  • EDIT: I also add following code, but I got the same error

      protected override AuthenticationModelContainer CreateDataSource() {
                AuthenticationModelContainer authenticationModelContainer = new AuthenticationModelContainer("name=AuthenticationModelContainer");
                authenticationModelContainer.ContextOptions.ProxyCreationEnabled = false;
                return authenticationModelContainer;
            }

    Friday, July 27, 2012 10:08 AM
  • SOLVED: My entities are in separate aasambly...so

       protected override AuthenticationModelContainer CreateDataSource() {
                var authenticationModelContainer = new AuthenticationModelContainer("name=AuthenticationModelContainer");
                authenticationModelContainer.ContextOptions.ProxyCreationEnabled = false;
                authenticationModelContainer.MetadataWorkspace.LoadFromAssembly(typeof(User).Assembly);
                return authenticationModelContainer;
            }

    Friday, July 27, 2012 10:26 AM
  • Hi Andrea Armellini,

    Welcome to MSDN Forum.

    I'm glad to hear that you have solved the issue, and thanks for your sharing. : )

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Monday, July 30, 2012 2:00 AM
    Moderator