Referencing system.web.cors

2019-03-17 14:01发布

I'm trying to implement cors support in my Web API.

I have read a couple of blog posts on this topic, but I can't seem to find System.Web.Cors.dll or System.Web.Http.Cors.dll

Is there something I need to install?

4条回答
Animai°情兽
2楼-- · 2019-03-17 14:27

The System.Web.Cors assembly is now available on NuGet in the Microsoft.AspNet.Cors package. This is currently a prerelease package, so if you're using the Visual Studio package manager, you'll need to include prerelease packages.

查看更多
老娘就宠你
3楼-- · 2019-03-17 14:35

According to this thread, you can get it using nightly builds of ASP.NET using nuget (see instructions here). But it sounds like it is only compatible with v5 of System.Web.Http so you'll potentially need to get that also. That is certainly not RTM so you'd have to be comfortable with that.

查看更多
ら.Afraid
4楼-- · 2019-03-17 14:38

The only way to use System.Web.Cors locally is to use the nightly builds as per this discussion. http://aspnetwebstack.codeplex.com/discussions/436442

查看更多
祖国的老花朵
5楼-- · 2019-03-17 14:45

Create a .NET 4.5 MVC project, install nuget package "Microsoft ASP.NET Web API [version] Cross-Origin Support" (search for "cors" and it will be on 1st or 2nd place in list). That's it.

P.S. If you encounter errors try to install "Microsoft ASP.NET Web API [version]" package too (search for "WebApi").

查看更多
登录 后发表回答