locked
Cant call OData Endpoint, get Exception : Could not load file or assembly 'System.Spatial, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies RRS feed

  • Question

  • Hi,

    I have added an OData endpoint to my solution. I used Nuget to get the required Dlls in .net4.5. It works perfect when i call the service from within my development environment, but as soon as i deploy to our Development Server, and call the Endpoint, i get an error.

    Exception:System.TypeInitializationException: The type initializer for 'System.Data.Services.Client.TypeSystem' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'System.Spatial, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

       at System.Data.Services.Client.TypeSystem..cctor()

       --- End of inner exception stack trace ---

       at System.Data.Services.Client.TypeSystem.GetElementType(Type seqType)

       at System.Data.Services.Client.Metadata.ClientTypeUtil.TypeOrElementTypeIsEntity(Type type)

       at System.Data.Services.Client.DataServiceContext.ValidateExecuteParameters[TElement](Uri& requestUri, String httpMethod, Nullable`1& singleResult, List`1& bodyOperationParameters, List`1& uriOperationParameters, OperationParameter[] operationParameters)

    As I understand, it cant find a version 5.0.0.0 of System.Spatial. I have checked that it is the exact same version i have running locally and on the server. I have added my packages.config below.

    <packages>
      <package id="AutoMapper" version="3.0.0" targetFramework="net45" />
      <package id="EntityFramework" version="5.0.0" targetFramework="net45" />
      <package id="jQuery" version="1.6.2" />
      <package id="jQuery.Ajax.Unobtrusive" version="2.0.20126.16343" />
      <package id="jQuery.UI.Combined" version="1.8.11" />
      <package id="jQuery.Validation" version="1.8.1" />
      <package id="jQuery.Validation.Unobtrusive" version="2.0.20126.16343" />
      <package id="knockoutjs" version="2.0.0.0" />
      <package id="log4net" version="2.0.0" targetFramework="net45" />
      <package id="Microsoft.AspNet.Providers" version="1.1" targetFramework="net45" />
      <package id="Microsoft.AspNet.Providers.Core" version="1.0" targetFramework="net45" />
      <package id="Microsoft.AspNet.WebApi" version="4.0.30506.0" targetFramework="net45" />
      <package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net45" />
      <package id="Microsoft.AspNet.WebApi.Core" version="4.0.30506.0" targetFramework="net45" />
      <package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.30506.0" targetFramework="net45" />
      <package id="Microsoft.Data.Services" version="5.6.0" targetFramework="net45" />
      <package id="Microsoft.Data.Services.Client" version="5.6.0" targetFramework="net45" />
      <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
      <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" requireReinstallation="True" />
      <package id="Modernizr" version="2.0.6" />
      <package id="Newtonsoft.Json" version="4.5.6" targetFramework="net45" />
      <package id="Ninject" version="3.0.1.10" targetFramework="net45" />
      <package id="Ninject.Extensions.Wcf" version="3.0.0.5" targetFramework="net45" />
      <package id="Ninject.Web.Common" version="3.0.0.7" targetFramework="net45" />
      <package id="System.Spatial" version="5.6.0" targetFramework="net45" />
      <package id="System.Web.Providers" version="1.2" targetFramework="net45" />
      <package id="WebActivator" version="1.5.3" targetFramework="net45" />
    </packages>

    Can anyone help me?

    Friday, October 4, 2013 12:49 PM

Answers

All replies

  • I am seeing 2 packages missing from the list: Microsoft.Data.OData and Microsoft.Data.Edm. Can you please make sure both these packages are added and the version is 5.6.

    Hope this helps.

    Thanks

    Pratik


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, October 4, 2013 3:56 PM
    Moderator
  • Hi,

    I Tried to  add the 2 packages to the packages.config, and redploy using TFS to our development server. Unfortunatly i still get the same error.

    <?xml version="1.0" encoding="utf-8"?>
    <packages>
      <package id="AutoMapper" version="3.0.0" targetFramework="net45" />
      <package id="EntityFramework" version="5.0.0" targetFramework="net45" />
      <package id="jQuery" version="1.6.2" />
      <package id="jQuery.Ajax.Unobtrusive" version="2.0.20126.16343" />
      <package id="jQuery.UI.Combined" version="1.8.11" />
      <package id="jQuery.Validation" version="1.8.1" />
      <package id="jQuery.Validation.Unobtrusive" version="2.0.20126.16343" />
      <package id="knockoutjs" version="2.0.0.0" />
      <package id="log4net" version="2.0.0" targetFramework="net45" />
      <package id="Microsoft.AspNet.Providers" version="1.1" targetFramework="net45" />
      <package id="Microsoft.AspNet.Providers.Core" version="1.0" targetFramework="net45" />
      <package id="Microsoft.AspNet.WebApi" version="4.0.30506.0" targetFramework="net45" />
      <package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net45" />
      <package id="Microsoft.AspNet.WebApi.Core" version="4.0.30506.0" targetFramework="net45" />
      <package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.30506.0" targetFramework="net45" />
      <package id="Microsoft.Data.Services" version="5.6.0" targetFramework="net45" />
      <package id="Microsoft.Data.Services.Client" version="5.6.0" targetFramework="net45" />
      <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
      <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" requireReinstallation="True" />
      <package id="Modernizr" version="2.0.6" />
      <package id="Newtonsoft.Json" version="4.5.6" targetFramework="net45" />
      <package id="Ninject" version="3.0.1.10" targetFramework="net45" />
      <package id="Ninject.Extensions.Wcf" version="3.0.0.5" targetFramework="net45" />
      <package id="Ninject.Web.Common" version="3.0.0.7" targetFramework="net45" />
      <package id="System.Spatial" version="5.6.0" targetFramework="net45" />
      <package id="Microsoft.Data.OData" version="5.6.0" targetFramework="net45" />
      <package id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" />
      <package id="System.Web.Providers" version="1.2" targetFramework="net45" />
      <package id="WebActivator" version="1.5.3" targetFramework="net45" />
    </packages>

    Is there anything else i can try?

    Monday, October 7, 2013 6:02 AM
  • Hello,

    For error message "Could not load file or assembly 'Microsoft.Data.Services, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.", there is a thread reagrding it:

    http://social.msdn.microsoft.com/forums/windowsazure/en-US/2d4c0010-a9df-4e54-af1a-55916965726a/cannot-use-wcf-data-services-in-a-wcf-service-web-role

    You can have a look at it.

    If this does not work for you, please let me know.

    Regards.

     


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Tuesday, October 15, 2013 7:12 AM
    Moderator