Run webapi without installing .net4.5 - asp.net

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.
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?
Or is it possible to have the API (using the Entity Framework)
run under .net 4.0
Thank you,
Mark

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)

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

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

Related

How to force web app on Azure to work with .net Framework 4.5.2?

My web app was running without any problem with web app referring to .net framework 4.5.2 earlier.
But after Azure portal decided to make a shift to .net framework 4.6, my application started giving exception.
I have entry for but that does not seems to be working.
Any way by which I can force web app to use .net framework 4.5.2?
A given VM can only have one version of the .NET 4.x framework, and at present Azure App Service has 4.6.2 (and soon 4.7)
Note that it has had 4.6 or higher for several years, so I suspect your issue is not directly related to this.
If you think you do have a situation where something that worked on 4.5.2 breaks on 4.6.2, I encourage you top post a separate question. But the answer to this question is that you don't control the 4.x version running on App Service.

Can I use .NET 4.6 for main domain and .NET Core for api

So I've developed a standard .NET 4.6 CRUD app that adds / edits / deletes data in a SQL Express database and is hosted on Azure. This will only be used by a couple of people to manage data for the main project which will be a one page Angular / mobile app. The next step is to develop an api (with .NET Core) so the data can be consumed by the Angular / mobile app.
What I'm wondering is if I already have the main CRUD app created with .NET 4.6, can I create an api in the same domain using .NET Core? Something like this:
mydomain.com - .NET 4.6
mydomain.com/api - .NET Core
Sure you can do this, you can also run a node.js app on mydomain.com/api_js for that matter, it's all about how do you configure your web server.
If it's a question how to configure the web server, you need just to google about your particular web server.
If it's a question if that makes sense - in my opinion yes, MS is putting now so much effort in being multi-platform, that my bet would be on the .NET Core being more future proof.
Only you have to keep in mind, that it won't be a simple reference adding to reuse the code, as it's not possible to reference .NET 4.x assemblies from a .NET Core project.
But it's possible the other way around, so you can abstract away the code you want to reuse from your .NET 4.6 project into a shared .NET Core assembly, which than may be referenced by both projects.

HelpPage for ASP.NET vNext MVC 6 Web Api

I am currently checking out asp.net vnext MVC6 in Visual Studio 2015 Preview. I'm pretty new to asp.net in general, but within my company we are going to move towards creating a web api using asp.net for accessing data on our server (currently we only support wcf communication with our own silverlight application). This is the reason I am checking out the new functionalities of MVC 6 to judge whether we should wait before starting our development and use MVC 6 when it is finally released or start development now and create a Web API 2 project.
Anyway, I am looking into auto documenting the web api, which is already integrated into the Visual Studio template for a WebApi 2 project by use of Microsoft.AspNet.WebApi.HelpPage.
Now for my question, is something like this available for MVC 6 aswell? I can import the same package in my project.json in my ASP.NET vNext / MVC6 (whatever you want to call it) project but i can't do app.UseHelpPage(); in my Startup.cs file.
I suspect this is not (yet) integrated in the current release yet. If not, is there anything known about integration of this feature once ASP.NET vNext eventually hits the shelves?
Probably this feature is not available in MVC 6 yet, but you could try Swagger.
Swagger basically is a framework for describing, consuming, and visualizing RESTful APIs.
The nice thing about Swashbuckle that it has no dependency on ASP.NET MVC, so there is no need to include any MVC Nuget packages in order to enable API documentation, as well Swashbuckle contains an embedded version of swagger-ui which will automatically serve up once Swashbuckle is installed.
Source: http://bitoftech.net/2014/08/25/asp-net-web-api-documentation-using-swagger/

What is ASP.NET vNext?

Can anybody tell me what is ASP.NET vNext?
Every new version on .Net is something like .NET 1.0, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0 then why this version is not something like ASP.NET 6.0?
vNext is just the name given to product in the pre-release mode, like c# vNext which will apparently be released as C# 6.0, maybe ASP.NET vNext will have a numbering when it releases.
What is ASP.NET vNext?
Microsoft ASP.NET vNext is a smaller and efficient framework as a result of rebuilding the libraries from ground up.
What's new in vNext
Cloud-optimized versions of MVC, Web API, Web Pages, SignalR, and Entity Framework.
MVC, Web API, and Web Pages will be merged into one framework, called MVC 6.
MVC 6 has no dependency on System.Web. The result is a leaner framework, with faster startup time and lower memory consumption.
vNext is host agnostic. You can host your app in IIS, or self-host in a custom process.
Dependency injection is built into the framework. Use your preferred IoC container to register dependencies.
vNext uses the Roslyn compiler to compile code dynamically. You will be able to edit a code file, refresh the browser, and see the changes without rebuilding the project.
vNext is open source and cross platform.
More information:
Overview on asp.net
Getting started with ASP.NET vNext
Blogpost by Scott Hanselman
Blogpost by David Fowler
Contributing to ASP.NET vNext
Sample ASP.NET vNext applications
ASP.NET vNext is the next version of ASP.NET, but it hasn't shipped yet, so it is not an official version. "vNext" is just a working title.
ASP.NET vNext was the code-name for the next generation of ASP.NET, whose official name is ASP.NET 5. As of now ASP.NET 5 is not yet finished and documentation about can be found at http://asp.net/vnext.
ASP.NET 5 is not just an evolution of the previous version(s), it is rebuilt from the ground. Existing ASP.NET applications will run on ASP.NET 5 without modifications, but to take advantage of the new features, such applications will have to be ported to the new version.
Here's a little excerpt of what http://asp.net has to say about ASP.NET 5:
ASP.NET 5 is a lean .NET stack for building modern web apps. We built it from the ground up to provide an optimized development framework for apps that are either deployed to the cloud or run on-premises. It consists of modular components with minimal overhead, so you retain flexibility while constructing your solutions.
ASP.NET 5 includes the following features:
New flexible and cross-platform runtime
New modular HTTP request pipeline
Cloud-ready environment configuration
Unified programming model that combines MVC, Web API, and Web Pages
Ability to see changes without re-building the project
Side-by-side versioning of the .NET Framework
Ability to self-host or host on IIS
New tools in Visual Studio 2015
Open source in GitHub
The changes we made for ASP.NET 5 were based on customer requests and feedback. These changes simplify development, hosting, and maintenance, and are targeted to modern web apps.
Your legacy apps will run on the new version of the ASP.NET without any modifications. However, to take advantage of the new features in ASP.NET 5, you will need to port your existing code to the new framework. You will find many similarities between ASP.NET 5 and earlier versions of ASP.NET, so porting code involves fixing particular issues rather than re-writing the app.

Convert a web app created in VS 2010 ASP.NET 4.0 to ASP.NET 3.5

I've made a web app in VS 2010 and by default, I think it uses the .NET Framework 4.0. Problem is, the server that's going to run it doesn't have 4.0.
Is there a way to downgrade the project? I'm not really knowledgeable with web hosting or web servers so I don't really know which is easier, downgrading the project or upgrading the web server. It's a company web server by the way, so I'm not sure about the legalities and stuff. It's free though, right?
Just right-click on the project in the Solution Explorer and go to properties. Under the "Application" tab, change the "Target Framework" from 4.0 to 3.5. That should do it provided you are not using any code features unique to 4.0.
If you can update the server easily, I would recommend that so that you have the 4.0 framework available to you going forward. The .NET framework is a free download.
Right-click on the project name and select Properties On the Application tab, you should see a Target framework: dropdown.

Resources