richardwhatever
richardwhatever

Reputation: 5143

Unable to get Web API to work in my MVC application

I get the following exception when i access the Web api route, but the site works fine otherwise.

I'm running MVC application that is still partially on web forms. We're using structuremap for DI, and I followed the advice here (http://lucid-nonsense.co.uk/dependency-injection-web-api-and-mvc-4-rc/) to set up DI for WebAPI, but it made no difference.

What requires System.Data.Services 3.5.0? It seems odd to me that this is 3.5 and not 4.x

System.IO.FileNotFoundException Could not load file or assembly 'Microsoft.Data.Services, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) at System.Reflection.RuntimeAssembly.GetExportedTypes() at System.Web.Http.Dispatcher.DefaultHttpControllerTypeResolver.GetControllerTypes(IAssembliesResolver assembliesResolver) at System.Web.Http.WebHost.WebHostHttpControllerTypeResolver.GetControllerTypes(IAssembliesResolver assembliesResolver) at System.Web.Http.Dispatcher.HttpControllerTypeCache.InitializeCache() at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue() at System.Lazy1.get_Value() at System.Web.Http.Dispatcher.HttpControllerTypeCache.get_Cache() at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.InitializeControllerInfoCache() at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue() at System.Lazy1.get_Value() at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.SelectController(HttpRequestMessage request) at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsyncInternal(HttpRequestMessage request, CancellationToken cancellationToken) at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)

Many thanks!

Upvotes: 1

Views: 828

Answers (1)

nsns
nsns

Reputation: 26

Your system missing .Net Framework 3.5 SP1 which comes with ADO.Net Data Services. You can try to install ADO.NET Data Services v1.5 CTP2: http://www.microsoft.com/en-us/download/details.aspx?id=23113 and see if it works. Even if gives error during installation it might work. Which DB Context Generator are you using? If you using EF 4.x DbContext Generator then it might need older version of Data Services i think. EF 5 which comes with MVC4 don't work with VS2010.

Upvotes: 1

Related Questions