ASP.NET 5 beta8

ASP.NET 5 beta8 announced

ASP.NET team has announced ASP.NET 5 beta8. You can download ASP.NET 5 beta8 using NuGet Packages and ASP.NET tooling for Visual Studio. You can find installation instruction for ASP.NET 5 beta8 for Windows, Linux, and Mac.

Document and samples of ASP.NET 5 beta8 can be found at http://docs.asp.net

What is an announcement in ASP.NET 5 beta8?

There would be changes like

DNX Watch Command
DNX Watch has file watcher. Your application will be restarted when you change any file in your application. To install DNX-watch use following command

dnu commands install Microsoft.Dnx.Watcher

You can use watch command like dnx-watch . You can start to watch command from the same directory of Project.json

While publishing your application, you can Specify target frameworks
You can specify target framework of application at the time of publishing your application using the following command

dnu publish -framework dnx45

and it will only trim publish package and include only those set of packages that required for your application and
resulting in smaller deployed package.

Targeting old frameworks
Now, you can target .NET 2.0 and .NET 3.5 frameworks in your DNX projects. You just need to specify net20 and net35 into target framework of Project.json file.

Clear HTTP Response Cache used for package response
When restoring packages dnu do HTTP caching for any request send. You can use the following command to clear the cache.

dnu clear-http-cache

DNVM uninstall
Whenever you are keeping updated with your latest DNX releases, you might be in a situation like DNX hanging out your machine. You can find ~/.dnx/runtimes folder into your user profile directory and delete older versions anytime. This is a just tedious task. So now, you can run dnvm uninstall to remove or uninstall specified runtime.

Add additional files to a package
DNX generating NuGet Packages for your projects, but, in that case, you are in a need to add additional files to your package. You can now add additional files to NuGet packages by specifying in project.json using new packInclude property.

"packInclude": {
    "destination1Directory/": "source1Directory/**",
    "destination2Directory/": "source2Directory/**",
    "destination2Directory/some_additional_file.txt": "source2a/somefile.txt",
    "destination3Directory/": ["source3Directory/file1.txt", "source3Directory/file2.txt"]
}

You can specify the set of source and destination directory to include into the package. You can also add files using pattern and array of files.

Run script for each specified framework and creating the package.
With DNX, you can handle multiple framework(like net45,net46 or dnxcore50), and multiple build configuration like debug and release). In project.json you can specify the script that run on before and after each package creation and build. before ASP.NET 5 beta8 script was run twice.

Consider you have two dotnet frameworks and two build configuration say release and debug. Now, your script can run four times once for each framework and once for each build configuration. The prepack and postpack script run twice once for each build configuration.

Change in IIS Hosting model
Up to ASP.NET 5 beta8 application runs in IIS have been hosted by the component called “Helios”, contained in the Microsoft.AspNet.Server.IIS. This component facilitated the bootstrapping of the DNX and subsequently the .NET CLR or Core CLR by way of utilizing a hook in the existing System.Web hosting model to replace the runtime after the application had started.

In ASP.NET 5 beta8, they have discontinued the “Helios” IIS host to reduce complexity and manageability of two hosting environments. Now, Hosting ASP.NET 5 applications in IIS will now be achieved using the IIS HttpPlatformHandler configured to forward through to the ASP.NET 5 Kestrel server. HttpPlatformHandler module is native IIS module hence it needs to be install by Administrator.

ASP.NET 5 beta 7

ASP.NET 5 beta 7 announced, What is new? Part – 3

As we already discuss some new features about ASP.NET 5 beta 7 in my previous post at

  1. ASP.NET 5 beta 7 announced, What is new? Part – 1

  2. ASP.NET 5 beta 7 announced, What is new? Part – 2

and, we are going to discuss more here.

ASP.NET 5 beta 7
What is new in ASP.NET 5 beta 7

Improvements and bug fixes in ASP.NET 5 beta 7

This blog post is the last post of the series of what is new in asp.net 5 beta 7. so, we are going to cover the rest of all things plus newly released WebHooks preview of ASP.NET family.

Razor
With the release of ASP.NET 5 beta 7, they had added the ability for a TagHelper to be written void element. The default value of CloseAfterOpeningTag will be false with the behaviors of IF there are multiple TagHelper working on a single HTML element.

When the user calls TagHelperContext.GetChildContentAsync it was uses cached the result, so in this release of ASP.NET 5 beta 7, they add an overload to reevaluate by passing useCachedResult to false in overload method.

Task<TagHelperContent> GetChildContentAsync()
{
    return GetChildContentAsync(true);
}

Task GetChildContentAsync(bool useCachedResult)
{
    ...
}

Another improvement in MVC is that, consider following Razor syntax with line comment.

<span> Here is your content</span>
@* this is just dummy content to demostrant improvement in MVC *@
 Here is your another content

This Razor syntax renders with carriage return something like,

<span> Here is your content</span>

<span> Here is your another content</span>

Instead of this it should have been rendered like

<span> Here is your content</span>
<span> Here is your another content</span>

They had also introduced single line comment like @//

Now, Rozar handling ~/ from its core and stripped out regardless its path or URL and auto attribute removal in TagHelper

Routing
Routing is just middleware for routing the request to application request. It sits between application request and files which are not present physically in your web application.

Security
ASP.NET security contains authentication, authorization and security middleware for ASP.NET only. ASP.NET security removed basic authentication due to its insecure and having performance issues. ASP.NET security has Data Protection API and integrates with most of the project like SignalR.

Session
In the previous version of asp.net, there was sluggish Session, which will degrade the performance of your application. Now, ASP.NET 5 support middleware for the session, and for that you just have to set up session database.

UserSecrets
While developing the modern web application, the programmer often saves oAuth secrets, and due to security risks they do not want to commit that file into source control. It’s more dangerous while working with open source projects using public source control system like Github.

The config file that is used in DNX based application that guide developer to not checking those resources to public source control.

WebHooks
WebHooks was not part of the initial release of ASP.NET 5 beta 7. Lately, WebHooks preview has been added to ASP.NET 5 family as of its simplicity and its lightweight HTTP based publish/subscribe pattern. When an event happens in service, HTTP based POST notification sent to the register subscribers. Post notification contains the information regarding events and that information is helpful for the receiver to act accordingly.

ASP.NET 5 WebHook Receivers
ASP.NET 5 WebHook Receivers

Due to its simplicity many organizers using it as APIs like Dropbox, Paypal, Slack, Instagram, Trello etc.

I will write more about all ASP.NET 5 features with more technical stuff including WebHooks in near feature. But due to the limitation of subject, I can’t include all topic in-depth. Thanks