ASP.MVC 6 Features - In Memory Execution

In one of the earlier post we have seen that in MVC 6 it's now possible to do edit-and-continue very much like what we do while developing a desktop application

Similarly, another important feature shipped with MVC 6 is the ability to do in memory compilation of the code. That means while building the application, output is generated in the bin folder and the web server load the files from there to run the application. But in MVC 6 this is turned of  by default and the files are compiled and stored in memory. One advantage of doing this is that it reduces the start up time considerably since there is very little time spent on disk I/O operations.

Let's create a sample MVC 6 web project by selecting the Web Application template under ASP.NET 5 from Visual Studio.

Visual Studio will create MVC project with model, controllers and views out of the box and you will get a barebone site without writing a single line of code.

 

So let's hit F5 and the site will get opened in the default browser. In MVC 6 the bin folder has been moved out of the root directory and it now resides in the artifacts folder in the project directory. 

As you can see from the below screenshot, the bin folder is empty eventhough the application is running in the browser. Normally we have all the dll's of the references added in the project as well as dll of the application will be created in the bin folder. In our case since in memory compilation is enabled by default, all these files are compiled and loaded in memory only and that's why this folder is empty.

If you want to generate the output during the build, you can enable if from the Project properties. Bring up the Project Properties dialog either from Project -> Project Properties or by right clicking on the project and then select the Project Properties option. In that page there is an option to select Produce outputs on build option.

Now, when you run the application, all the dll's will be created in the bin folder as shown below.

   


No Comments

Add a Comment