跨域Web API:安装包Microsoft.AspNet.WebApi.Cors不起作用

时间:2014-04-23 08:42:30

标签: asp.net-web-api cross-domain nuget-package

由于跨域调用Web API项目无法在IE中使用ASP.NET Web窗体客户端(在其他浏览器中工作)。我想我需要安装以下Nugget pakage。

安装包Microsoft.AspNet.WebApi.Cors

但是当我尝试安装它时,我遇到了以下错误。

Install failed. Rolling back...
Install-Package : Could not install package 'Microsoft.AspNet.WebApi.Client 5.1.2'. You are trying to install 
this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any as
sembly references that are compatible with that framework. For more information, contact the package author.
At line:1 char:16
+ Install-Package <<<<  Microsoft.AspNet.WebApi.Cors -pre -project WebAPI
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

我正在尝试安装: Visual Studio 2010,面向.NET 4.0。

.NET 4.0不支持此软件包吗?

最诚挚的问候 Hardeep

1 个答案:

答案 0 :(得分:1)

.NET 4.5是5.0及以上版本的Web API的最低要求。