Run the same web application on ASP.NET 2 and 4 - asp.net

Can you run the same web application (ASP.NET MVC 2) on ASP.NET 2 as well as ASP.NET 4? The application is developed and built for .NET 3.5 SP1.
My initial guess is you can't, due to vast differences in standard web.config files between these two runtimes. Is this correct?
If two web.configs were supplied, one for each ASP.NET version, should it, in principle at least, run correctly?

A .NET 2 app should still run under Framework 4.x, but not necessarily the other way round - that would depend if you've used any framework features that weren't present in the earlier version.

Related

Does ASP.NET use a different .NET framework than desktop?

I Was just reading this post: http://blogs.msdn.com/b/dotnet/archive/2014/12/04/introducing-net-core.aspx
It left me a bit confused since the first picture in the article seems to imply that .NET desktop apps and ASP.NET don't share the same framework implementation. I was always under the impression that it was. Any ideas?
They use the same .NET framework.
But they don't have to. And this is the way the .NET ecosystem is evolving right now - ways to avoid using the full (ever growing) .NET framework for everything.
As a bonus, the new .NET Framework Core is open-sourced. This is not entirely posssible with the whole .NET framework, since it includes a whole lot of licenses and proprietary technologies.
Given all that, it's now possible to deploy very light-weight web applications using ASP.NET, not even having to use IIS (thanks to OWIN). You only have to include the packages you need - instead of having a single monolithic runtime and BCL, there's hundreds of NuGet packages you choose to use (or not).
You will have to better define "the same framework implementation", as they (full .NET Framework and .NET Core) are built from the same code base with different configuration, and also host your web applications in a slightly different way.
The most important getaway of that article should be "ASP.NET 5 can run on both .NET Framework 4.6 and .NET Core 5". You get different benefits from each runtimes,
.NET 4.6 gives you best compatibility against previous .NET runtimes.
.NET Core 5 gives you flexibility on running multiple customized DNX side by side, and portability to Linux and OS X.
Unfortunately Microsoft decides to limit desktop apps to .NET 4.6, but Mono guys have demonstrated possibility to run some (such as WinForms apps) on .NET Core,
https://github.com/akoeplinger/mono-winforms-netcore

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.

Referencing 3.5 and 4.0 Assemblies from ASP.Net 2.0 Website

I am making a small enhancement to an old ASP.Net 2.0 Website (not web application--not sure if that matters). I have referenced a set of assemblies that target 3.5 and 4.0.
I was surprised to find that everything seems to work. I can successfully make calls to the methods within the assemblies and all is well.
What I'm concerned about is that there will be some run time problem down the road, or after deployment. Am I fine as long as the targeted .net framework versions are deployed on the servers? I'm also curious what would happen if I made a call to a method that internally used something from .Net 4.0 that didn't exist back in 2.0 (e.g. Linq).
I can't upgrade the web site to .net 4.0, as that would require regression testing of the full application (by company policy and common sense). That said, I do have the option of re-implementing the functionality I need in a .Net 2.0 project.
So--is referencing libraries built with newer .Net versions high risk, or am I out of the woods if it works on my local machine?

Using ASP.NET MVC 4 and Web API components within a .NET f/w 4.0 and VS2010-constructed app

I'm a little confused about one thing with version levels of various .NET software components related to ASP.NET MVC and the web api. Now I know VS2012 and .NET f/w 4.5 are going RTM "real soon now", but I don't want to make that up-transition for awhile (as in 6 months or longer). I am coding a new app right now whose initial incarnation (dictated by consulting client) has to be .NET f/w 4.0 and utilizing VS2010 (yes I know you can target downwards with VS2012 but that is not an option for me in this case - as a consultant you are sometimes dictated the tools/versions etc that you MUST use for a contract). So finally to the crux of my question - I just came across an article on MSDN by Mike Wasson, written in Jan/Feb 2012 timeframe, and it looks as if he used VS2010 and .NET f/w 4.0, but demonstrating the new-ish Web API technology utilizing ASP.NET MVC 4. So it IS possible to install the ASP.NET MVC 4 component within the context of .NET f/w 4.0 and VS2010, AND utilize the Web API component? Which, if that is true, I might want to do with this particular project rather than just using ASP.NET MVC 3 (and without using the Web API stuff at all), which is what i thought I would need to do. It's just that I thought to use ASP.NET MVC 4 and/or the Web API stuff, one HAD to use .NET f/w 4.5 RC and VS2012 RC prior to Sep 12 (or their RTMs after Sep 12). Is that not correct?
You can use mvc 4 and web api with .net 4.0. You cannot use features of .net 4.5 in it but all other will work.
So it IS possible to install the ASP.NET MVC 4 component within the
context of .NET f/w 4.0 and VS2010
Of course. It's RC at the time of this writing but you could download and install it from here: http://www.asp.net/mvc/mvc4 (Download the standalone installer executable for VS2010 from here: http://www.microsoft.com/en-us/download/details.aspx?id=29935)
Even when it hits RTM you will be able to use it with VS2010. Of course you won't be able to use .NET 4.5 speicic features with VS2010 though (things like async/await).

Can ASP.NET MVC 3 run inside a ASP.NET 3.5 web site?

I would like to know if it is at all possible to get an MVC3 solution wrapped in a CWAB (Composite Web Application Block) solution built in 3.5?
I'm aware that in IIS, 2.0/3.5 and 4.0 sites can run next to each other (but in different application pools) but because of the CWAB layer I do not have this luxury. I got MVC2 running successfully before but MVC2 is on the 2.0 runtime if what I've read is true.
I would really like to use Razor as well so going back to MVC2 in this scenario is not really an option.
It should be possible. Just set your application pool runtime to 4.0 instead of 2.0.
.NET 4.0 runtime will be able to handle .NET 3.5 assemblies.
Razor requires features in .NET 4.0. However Tom Clarkson has a post called ASP.NET MVC 3 Razor View in SharePoint that talks about a (not-so-pretty) work-around. Basically, generate the view code from the cshtml files in .NET 4 and you can use them in .NET 3.5 (with a modified RazorEngine).
I'm encountering the same issue. The way I'm going to handle it is to write a WCF "front end" to SharePoint (.Net 3.5) and this will allow me to write the MVC app using MVC 3.

Resources