.NET 的 OData 端点

OData Endpoint with .NET

我正在尝试为数据库中的 table 值函数创建一个 odata 端点。我对代码很确定,但是在 运行 应用程序上我得到了错误

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

我已经验证了程序集路径和我的代码,但是这个错误我无法理解,我被困了 3 个小时。一样的。

检查 web.config 中的程序集绑定。您可能需要这样的东西(或者您可能必须删除一个)。确保任何绑定都指向您的 bin 文件夹中现有的程序集。

  <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>

此外,更新 NuGet 程序包以确保下载并解析所有最新的程序集。