Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Azure and WCF Data Services V3

My question is:
why does WCF Data Services 5.2.0 work under Azure Emulator and not under Azure Staging/Production environment?

I get this error on server:

Could not load file or assembly Microsoft.Data.Services, 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)

instead on emulator it works perfectly..

My project reference assemblies are:

  • Microsoft.Data.Services 5.2.0.0
  • Microsoft.Data.Services.Client 5.2.0.0
  • Microsoft.Data.OData 5.2.0.0
  • Microsoft.Data.Edm 5.2.0.0
  • System.Spatial 5.2.0.0
  • Microsoft.WindowsAzure.Storage 2.0.0.0

V3 is very useful to show data in JSON without other libraries.

like image 946
Gabriele Claut Avatar asked Dec 05 '25 08:12

Gabriele Claut


1 Answers

The problem can be related to the fact that in the .svc file there is an hardcoded reference to the GACed version: 5.0.0.0

<%@ ServiceHost Language="C#" Factory="System.Data.Services.DataServiceHostFactory, Microsoft.Data.Services, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Service="Forward.TestService " %>

If your dlls have Copy Local attribute set to true, you should be able to remove version and solve the problem

<%@ ServiceHost Language="C#" Factory="System.Data.Services.DataServiceHostFactory, Microsoft.Data.Services, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Service="Forward.TestService " %>
like image 105
Ivan Fioravanti Avatar answered Dec 08 '25 19:12

Ivan Fioravanti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!