Run webapi without installing .net4.5

﹥>﹥吖頭↗ 提交于 2019-12-13 15:12:24

问题


I have a website running aspx pages, under asp.net4.0.

I also have some DevExpress controls, that I purchased 4 years ago.

I now want to add an API to the web application, however I understand that needs .net4.5 to be running.

The DevExpress controls don't work under 4.5 - so I would need to renew them at considerable cost.

  1. it possible, after installing .net4.5, for my site to continue to use .net4 - and not the new 4.5? so that I can have the site operate under 4.0, and the API under 4.5?
  2. Or is it possible to have the API (using the Entity Framework) run under .net 4.0

Thank you,

Mark


回答1:


You can use both web-api and entity framework without installing .net4.5.

You can add web-api to an existing project by installing the nuget package "Microsoft.AspNet.WebApi" (release candidate)




回答2:


  1. Yes, if you put your Web API in a separate project, you can make it 4.5 and the other projects you have that make up the site can be 4.0. You choose which framework you target when you build your projects: Right click on project > Application > Target framework dropdown

  2. You can add Web API to any .NET application that uses at least .NET 4.0. Web API doesn't require .NET 4.5. It can be a Web Forms project, MVC project, empty project, console app, WPF app, Metro app etc etc - as long as .NET version is at least 4.0.

But the simplest solution in your case seems to be to just keep everything under 4.0.




回答3:


You better recreate the web API project using final version of the WepAPI assembly

Tutorial: http://david.gardiner.net.au/2015/08/aspnet-web-api-for-net-framework-4-in.html



来源:https://stackoverflow.com/questions/11541283/run-webapi-without-installing-net4-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!