Search code examples
c#asp.netvisual-studio-2013odataasp.net-web-api

OData Endpoint with .NET


I am trying to create an odata endpoint for a table valued function in a database. I am sure with the code, however upon running the application i get the error

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'ODataService.WebApiApplication'.

Source Error: 


Line 1:  <%@ Application Codebehind="Global.asax.cs" Inherits="ODataService.WebApiApplication" Language="C#" %>

Source File: /global.asax    Line: 1 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248

I have verified the assembly paths and my code and however this error I can't understand and I am stuck for 3 hours in this. The same thing.


Solution

  • Check your assembly bindings in the web.config. You might need something like this (or you might have to remove one). Ensure that any bindings are pointing to the assemblies existing in your bin folder.

      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
    

    Also, Update NuGet packages to make sure all the latest assemblies are downloaded and resolved.