locked
Deploying WCF 5.0 RRS feed

  • Question

  • Just installed WCF 5.0 on my development system.

    Went through the process of eliminating references to system.data.services and system.data.services.client, and got it to work just fine.  I'm able to pull up my service just fine on my development system.

    However, deploying the project to the production server created a problem that I cannot seem to overcome.

    When navigating my browser directly to the *.svc url, I get this instead of the WSDL: 

    The server encountered an error processing the request. The exception message is 'On data context type 'xxxEntities', there is a top IQueryable property 'xxx<entity_collection_property>xxx' whose element type is not an entity type. Make sure that the IQueryable property is of entity type or specify the IgnoreProperties attribute on the data context type to ignore this property.'. See server logs for more details. The exception stack trace is:

       at 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.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)

    Now, I've installed the WCF 5.0 onto the production server without a problem, and I copied the appropriate dlls into the /bin directory of my project.  I've even tried adding the assemblies in my web.config as follows:

    <compilation debug="true" targetFramework="4.2">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Data.Entity, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <add assembly="System.Spatial, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="Microsoft.Data.Services, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="Microsoft.Data.Services.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="Microsoft.Data.OData, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="Microsoft.Data.Edm, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
      <folderLevelBuildProviders>
        <remove name="DataServiceBuildProvider"/>
        <add name="DataServiceBuildProvider" type="System.Data.Services.BuildProvider.DataServiceBuildProvider, Microsoft.Data.Services.Design, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </folderLevelBuildProviders>
    </compilation>

    I'm assuming that the issue relates to .NET grabbing the wrong assemblies, but I've also tried to address the problem directly by placing an <ignoreproperties> attribute on the offending property, but still get the identical error.

    On a side note, in my SVC file, I still had to include a "Import System.Data.Services" and "Import System.Data.Services.Common"  in order to make this work.  Apparently VS did not find any namespace called "Microsoft.Data.*"  But again, it works just fine on my development server using oData v3 features.  Don't know if this had anything to do with anything but thought I'd throw this in here anyway.

    At this point, I'm not sure what to try next.

    Any thoughts?

    Thanks!

    Friday, June 8, 2012 8:00 PM

Answers

  • Hi John

    Look like here is the problem your project is currently using Dotnet 4.2 + EF 5.0 ("5.0.050524")  that looks incompatible (not well supported) with Dotnet 4.2. and anyhow it is able to resolve at your system but not on production server box

    I would suggest to upgrade Dot.Net framework .  For me it works under following environment

    • VS 2012 RC ( Dot.Net framework 4.5) + EF 5.0 Data DLLs
    • VS 2012 RC ( Dot.Net framework 4.0) + EF 5.0 Data DLLs

    I would suggest to use  Dot.Net framework 4.5 RC as it already have EF 5.0 RC built-in and seems stable to me. Also several feature of EF 5.0 is not available to Dot.Net 4.0.

    I hope it will work for you.

    Thanks

    Ashwini

    • Marked as answer by John Lee123 Tuesday, June 12, 2012 1:01 PM
    Tuesday, June 12, 2012 4:56 AM

All replies

  • Is configuration of your developer box and server is same ? Look like you have some customization in data model that is causing failure 

    is the underlying data driver  is same on both dev box and server box , I faced a like error and root cause was the data driver (Devart) that was of different version on server

    First try installing a simple out of the box dummy service (make sure reference all DLL are marked as "Copy to Output" in property section including data drivers) and let see if that works


    • Edited by Ashwini47 Saturday, June 9, 2012 11:18 AM
    Saturday, June 9, 2012 11:13 AM
  • Ashwini,

    You might be on to something.  Could it have something to do with the fact I'm using EF 4.3.1?  (NOTE:  Quotes is my SQL table, and "Quote" is the Entity representation of it).

    I did create a simple WCFTest as you ask, removed all unused references, then copied all reference dlls to bin and get the following error on the production server (works fine on the dev of course)

    BTW, I get the same error when using EF 4.2.

    ----

    The server encountered an error processing the request. The exception message is 'The property 'EntityState' on type 'WCFTest.Quote' is not a valid property. Make sure that the type of the property is a public type and a supported primitive type or a entity type with a valid key or a complex type.'. See server logs for more details. The exception stack trace is:

    at System.Data.Services.Providers.ReflectionServiceProvider.BuildTypeProperties(ResourceType parentResourceType, IDictionary`2 knownTypes, IDictionary`2 childTypes, Queue`1 unvisitedTypes, IEnumerable`1 entitySets) at System.Data.Services.Providers.ReflectionServiceProvider.PopulateMetadataForTypes(IDictionary`2 knownTypes, IDictionary`2 childTypes, Queue`1 unvisitedTypes, IEnumerable`1 entitySets) at 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.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)

    Saturday, June 9, 2012 3:38 PM
  • Looks too hard to guess , it says that 'WCFTest.Quote is a property but as per you it is an Entity 

    Also look like you are using reflection provider ?

    Can you share you stand alone sample app (with some sample data in MDF file) may be that can help to diagnose, My email is ashwini47@gmail.com

    Sunday, June 10, 2012 6:59 AM
  • Thanks for looking at this.  I will send it via yousendit.com (as my email provider may zap the attachment).  The subject line will be:  From John Lee123.

    I've changed the database to an .sdf file in the app_data folder, and reduced the table schema to something ridiculously simple (ID, Quote_Name).  Once again, it works fine in the development system; however, I get a new error on the production server:

    Request Error

    The server encountered an error processing the request. The exception message is 'The specified store provider cannot be found in the configuration, or is not valid.'. See server logs for more details. The exception stack trace is:

    at System.Data.EntityClient.EntityConnection.GetFactory(String providerString) at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) at System.Data.EntityClient.EntityConnection..ctor(String connectionString) at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) at WCFTest.WCFTestEntities..ctor() in C:\Users\John Lee\Documents\Visual Studio 2010\Projects\BritAmericaDotComsv3\BritAmericaDotComs_v3\WCFTest\WCFTest\Model1.Designer.vb:line 35 at invoke_constructor() at System.Data.Services.DataService`1.CreateDataSource() at System.Data.Services.DataService`1.CreateDataSourceInstance() 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)

    Sunday, June 10, 2012 4:30 PM
  • Ashwini,

    I wonder if the problem lies in the machine.config?  I believe the IIS setup is identical, the project is obviously identical, and now the web.config is identical.  How do I know which machine.config for certain the project is using?  I'm using an x64 system, so would it be under c:\windows\microsoft.NET\Framework, or c:\windows\microsoft.NET\Framework64?

    Perhaps when installing either Framework 4.2, or CTP, or WCF 5.0 or one of these new features, something should have modified the machine.config but didn't.

    I'm going to keep digging.

    Thanks

    Sunday, June 10, 2012 4:45 PM
  • Ashwini,

    Well, I've confirmed that it has nothing to do with web.config, or machine.config. :(

    ... starting to run out of bullets to throw at this problem.

    Monday, June 11, 2012 4:55 PM
  • I had no idea that it would be such a problem with SqlServer compact, but I finally got it to the point where even the SqlServer Compact with the simplified project yields the same error message:

    The server encountered an error processing the request. The exception message is 'The property 'EntityState' on type 'WCFTest.Quote' is not a valid property. Make sure that the type of the property is a public type and a supported primitive type or a entity type with a valid key or a complex type.'. See server logs for more details. The exception stack trace is:

    at System.Data.Services.Providers.ReflectionServiceProvider.BuildTypeProperties(ResourceType parentResourceType, IDictionary`2 knownTypes, IDictionary`2 childTypes, Queue`1 unvisitedTypes, IEnumerable`1 entitySets) at System.Data.Services.Providers.ReflectionServiceProvider.PopulateMetadataForTypes(IDictionary`2 knownTypes, IDictionary`2 childTypes, Queue`1 unvisitedTypes, IEnumerable`1 entitySets) at System.Data.Services.Providers.ReflectionServiceProvider.PopulateMetadata(IDictionary`2 knownTypes, IDictionary`2 childTypes, IDictionary`2 entitySets) 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.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

    Monday, June 11, 2012 6:19 PM
  • It appears that it has something to do with targeting the Entity Framework June 2011 CTP, because when I target vanilla Framework 4.0, it works on both locally and on the production server.

    Unfortunately, I do need the new features in 2011 CTP so may have to try to move to EF5 beta and see if that works.

    Monday, June 11, 2012 7:55 PM
  • Hi John

    Look like here is the problem your project is currently using Dotnet 4.2 + EF 5.0 ("5.0.050524")  that looks incompatible (not well supported) with Dotnet 4.2. and anyhow it is able to resolve at your system but not on production server box

    I would suggest to upgrade Dot.Net framework .  For me it works under following environment

    • VS 2012 RC ( Dot.Net framework 4.5) + EF 5.0 Data DLLs
    • VS 2012 RC ( Dot.Net framework 4.0) + EF 5.0 Data DLLs

    I would suggest to use  Dot.Net framework 4.5 RC as it already have EF 5.0 RC built-in and seems stable to me. Also several feature of EF 5.0 is not available to Dot.Net 4.0.

    I hope it will work for you.

    Thanks

    Ashwini

    • Marked as answer by John Lee123 Tuesday, June 12, 2012 1:01 PM
    Tuesday, June 12, 2012 4:56 AM
  • Thanks,

    That's what I decided to do yesterday.

    In addition to getting .NET 4.5 and EF 5.0, I also need VS 2012 RC in order to target the framework properly to get the TVF feature I need.

    For those of you who are going through this mess, when you uninstall June 2011 CTP, you need to follow the directions here:

    http://blogs.msdn.com/b/adonet/archive/2011/06/30/announcing-the-microsoft-entity-framework-june-2011-ctp.aspx

    because your VS2010 will break (like mine) if you don't.

    Tuesday, June 12, 2012 1:00 PM