VS2015 MVC No compile experience - c#

It was my understanding that with the new compiler it is possible to run code without restarting an ASP.NET MVC project, e.g. the no-compile experience.
For example changing the model or controller requires restarting the entire project, which can take quite some time in VS2013 (especially with Code First).
Is this, basically edit&continue for ASP.NET, now possible in VS2015? I tried CTP5 but could not get this working.
Edit: The actual question
Does VS2015, or will it, support edit and continue or a similar experience (not having to restart for model/controller changes) for ASP.NET MVC?

Does VS2015, or will it, support edit and continue or a similar experience (not having to restart for model/controller changes) for ASP.NET MVC?
Visual Studio Edit and Continue is available and works for ASP.Net all the way back to version 2010 with constraints (IIS Express etc...).
Is this, basically edit&continue for ASP.NET
No. Scott Hanselman did a very detailed explanation of all the new features in vNext in this blog post Introducing ASP.NET vNext.
Excerpt:
One of the great aspects of environments like node or rails is that they are "no compile." Just change some code and hit refresh. With the next version of ASP.NET you get the power and throughput of the .NET runtime plus the "Roslyn" compiler-as-a-service for a "no-compile compile." That means means during development time you can just change your C# classes and hit Refresh in the browser. It's the power of .NET with the dynamism of a refresh-and-go development experience.
and
NOTE: This isn't ASP.NET Websites, or Razor View compilation - this is the whole thing, compiled in memory. You can use Visual Studio for development, or text editors like Sublime, or freakin' Notepad. (Of course, if you want assemblies on disk, you can do that too.)
and
See my web app’s bin folder in the screenshot below? There’s no assemblies in there because the assemblies never exist on the disk. It’s actually faster and easier to have the compiler do all the work in memory.

Related

What’s the benefits of Asp.net MVC projects precompilation?

My ASP.NET MVC project is taking more time than usual on the first hit,and it gets better afterwards, but the response goes slow again every next day. so It's a continuous performance issue
I googled the issue and most of the solutions are choosing precompilation during publishing, but Microsoft officials seemly didn’t confirm the operation can result in fast startup time for every request at any time.
So what exactly are the benefits of ASP.NET MVC Precompilation? Please advise
You can basically find the information here, there is also a fair amount of other relevant information on the advantages
ASP.NET Web Site Project Precompilation Overview
Precompiling an ASP.NET Web site project provides the following
advantages:
> Faster initial response time for users, because pages and code files
do not have to be compiled the first time that they are requested.
This is especially useful on large sites that are frequently updated.
A means to identify compile-time bugs before users see a site. (You
can also accomplish this when you compile a project in Visual Studio.)
The ability to create a compiled version of the site that can be
deployed to a production server without source code. This makes sure
that that people who have access to the production server will not be
able to view the source code.
You can also find similar questions here
What is the advantage of the ASP.NET precompilation?
What effect does the new precompile during publishing option have on MVC4 applications?
And some related information here
Precompiling Your Website (C#)
Because the pages must be automatically compiled when they are first
visited, there can be a short but noticeable delay when an ASP.NET
page is requested for the first time after being deployed.

Performance diagnostics of an ASP .NET MVC 5 website

I have an ASP .NET MVC 5 website which runs perfectly on my local machine, but after publishing it to a hosting provider response time from the server is always about 30 seconds (on localhost it is about 100-500ms depending on a page). And I am not talking about first response after some timeout, I am talking about every response, even to pages like "Hello world" with a very simple ViewModel and maybe a couple of strings in ViewBag. At the same time, the static content (like .css and .js files) are returned quickly. I have performed several optimizations, such as:
Installed Razor Generator and compiled all .cshtml files
Got rid of dynamic variables and ViewBags
Made sure that I'm using "release" configuration
Unfortunately, my hosting provider doesn't allow me to configure IIS Application pool, so I couldn't optimize Idle Timeout etc.
Sometimes (very rarely) response time becomes normal (about 200-500ms) but this is for a very short period of time. I've tried several hosting providers and the issue is still there, so it seems to me that there are performance problems with my website but unfortunately I cannot locate and fix them. I'm using shared hosting, by the way, not VDS. So, the question is: Are there any standard diagnostic procedures intended locate and fix performance problems with ASP .NET MVC websites?
After several times of trying to find out solution for the issue with bad performance, I tried to deploy one of Visual Studio's included MVC projects (like #mjwills advised) and it didn't have any performance issues so I was pretty sure that there were problems with my project, not hosting provider. So, the solution for me was to create a new project from scratch and move all code from previous one to the new project, also deleting all the junk code and unnecessary nuget packages. I think that problems were caused either by bad entity framework configuration or by problems with nuget packages installed.

Code Profiling ASP.NET MVC2 applications

The thread here seems close:
Profiling ASP.NET websites with EQATEC Profiler
However, in the free version of Equatec I downloaded today there is no checkboxes for ASP.NET, and ordinary web. I have pointed the App path to my bin directory in my project folder as well as started up the localhost hosting for my application via Visual Studio.
I am open to other free tools as well. I am just looking for someway to profile the code as to optimize some reflection we are using.
I am using the professional edition so unfortunantly do not have access to MS Code Profiling.
I am looking to do performance profiling at this point.
Is the free version of Equatec capable of doing ASP.NET applications?
Is there a free profiler (I realize this has been asked before, and little seems to have surfaced but paid apps, but might as well ask)?
Is MVC a special thing to look for in a profiler?
Comprehensive profiling tools still seem to be quite expensive. I like the dotTrace family, but they're not free.
You haven't specified what kind of profiling you want to do. Are you trying to understand more about the memory usage of your application, or CPU usage?
There is nothing special about MVC applications when it comes to profiling. You will need a profiler that's capable of launching ASP.NET. Beyond that, MVC is just a regular bunch of class libraries.
Have you tried the free CLR Profiler? It handles ASP.NET and will show both memory and some method call activity. It's not as comprehensive as say dotTrace, but it is a great free alternative if you're starting out.
The guide is actually not out of date: the few steps described in the stackoverflow duplicate question (last edited April 8th) still describes best how you should profile ASP.NET apps. Note that you should look at the accepted answer, the one with currently 16 upvotes.
After you've build the instrumented app the important thing to note in the stackoverflow-answer above is step 3: "load your app". It means that you should cause your app to be loaded and is the only step the profiler can't do automatically for ASP.NET apps.
You typically load the app simply by navigating to it in a browser so you simply need to do that after the build-step. When your (instrumented) code is activated the profiling part of it will spring into life and connect to the profiler and then you can take snapshots.
Note that ASP.NET doesn't need a main entry point. That's just an added convenience for automatically taking snapshots for real executables that has a Main method.
You just need a .NET profiler.
Profiling WebForms, MVC, SharePoint, Sitecore, Ektron, Sitefinity, or any other product that runs on .NET doesn't change that.

Downgrade asp.net Mvc from 3 to 2

I know this is a rather odd question, please don't flame me :)
I have a concrete need to "downgrade" a current Asp.Net Mvc 3 (net framework 4) application to Asp.Net Mvc 2 (net framework 3.5) because our shared hosting provider does not support .Net 4 (I know it's crazy considering it's been in retail since 12 Aprli 2010 and first beta came out in May 2009 but it's not the point of the post).
Is there any tool, or guide, or anything that could help in the process? I'm getting a bit lost because I upgraded many applications but I never had to downgrade one.
Besides strictly MVC, I'm using a data layer with EF Code First (maybe nhibernate will be the best tool to replace that?)
Any help, tip, info, whatever is appreciated.
Thanks.
EDIT: Changing hosting provider is not an option, otherwise I wouldn't have posted this at all. I personally am against this downgrade - I find it totally senseless - but still it's the only option.
I would change hosting provider. If your provider is not supporting .NET 4.0 now then do you really want to build a long term relationship with them? What happens the next new great feature is released, how long will they take to implement that? I don't think there's any future there if that's the kind of service they provide.
Saying that, if you have no choice but to remain with them, then I think your only option is to
Change the project's target framework setting in Visual Studio to 3.5.
Remove MVC 3 and add MVC 2
Change all Razor views to the Web Forms view engine syntax
Recompile and work through all the errors
For your web.config file I would create a new MVC 2 project and work from that web.config copying any extra settings needed from your old config.
Depending on the size of the project this is obviously going to a be a big task.
The only way I can think of is to get a machine with MVC 2 installed, get the project and try to compile it targeting .NET 3.5.
This will generate lots of errors.
Actually - this might be the way to convince those that hold the purse strings that you need to change hosting provider. You can show them the error list and put an estimate on how long it will take to fix them. If this is a long time (a couple of weeks?) then it might be more cost effective to move.
You can convert asp.net 4.0 website to asp.net 2.0 easily
Just make a new website
Then Select .net Framework 2.0
Copy the all files except web.config file from your asp.net 4.0 website folder in the new website folder
remove the unused usings from all the .vb or .cs files
Run the website easily

No Compilation Needed - Compile On Run

Something weird that I've been seeing, a web application written in ASP.Net (C#) that got the source code on the production server and compile that way. So when I deploy to the server I deploy the source code.
Why does .Net have this functionality? Doesn't make sense.
I have already posted as a comment that I believe that this is a "Web Site" project and not a "Web Application" project, but I wanted to also add this link, which includes some nice links to comparisons of the two project types.
http://www.codersbarn.com/post/2008/06/ASPNET-Web-Site-versus-Web-Application-Project.aspx
This is the way ASP.Net Web Sites work.
Notice that it's very similar to ASP classic, which ASP.Net superseded.
You can also deploy pre-compiled sites, if you want to.
Faster debugging cycle is my guess. For very large projects compiling everything takes time. If you're not interested in bleeding-edge performance (ie debugging a page or 2 over and over and over and over), you can choose not to recompile every time you make an adjustement.

Categories

Resources