//Cloud notes from my desk -Maheshk

"Fortunate are those who take the first steps.” ― Paulo Coelho

[Service Fabric] SF node fails to read DNS conf and fix

Recently SF developer reported this problem where his Azure Service Fabric > ImageStoreService(ISS) displayed a warning message due to one his secondary node down. This node was “down” all sudden without any change to his cluster/application. From the SF Explorer portal, we do noticed a brief warning message saying due to some unhealthy event, this node is down.

SF Explorer – warning

image

Error message

Unhealthy event: SourceId=’System.PLB’, Property=’ServiceReplicaUnplacedHealth_Secondary_00000000-0000-0000-0000-000000003000′, HealthState=’Warning’, ConsiderWarningAsError=false.
The Load Balancer was unable to find a placement for one or more of the Service’s Replicas:
ImageStoreService Secondary Partition 00000000-0000-0000-0000-000000003000 could not be placed, possibly, due to the following constraints and properties: 
TargetReplicaSetSize: 5
Placement Constraint: NodeTypeName==sf**type
Depended Service: ClusterManagerServiceName

Constraint Elimination Sequence:
ReplicaExclusionStatic eliminated 3 possible node(s) for placement — 2/5 node(s) remain.
PlacementConstraint + ServiceTypeDisabled/NodesBlockListed eliminated 0 + 1 = 1 possible node(s) for placement — 1/5 node(s) remain.
ReplicaExclusionDynamic eliminated 1 possible node(s) for placement — 0/5 node(s) remain.

Nodes Eliminated By Constraints:

ReplicaExclusionStatic — No Colocations with Partition’s Existing Secondaries/Instances:
FaultDomain:fd:/1 NodeName:_sf**type_1 NodeType:sf**type NodeTypeName:sf**type UpgradeDomain:1 UpgradeDomain: ud:/1 Deactivation Intent/Status: None/None
FaultDomain:fd:/4 NodeName:_sf**type_4 NodeType:sf**type NodeTypeName:sf**type UpgradeDomain:4 UpgradeDomain: ud:/4 Deactivation Intent/Status: None/None
FaultDomain:fd:/3 NodeName:_sf**type_3 NodeType:sf**type NodeTypeName:sf**type UpgradeDomain:3 UpgradeDomain: ud:/3 Deactivation Intent/Status: None/None

PlacementConstraint + ServiceTypeDisabled/NodesBlockListed — PlacementProperties must Satisfy Service’s PlacementConstraint, and Nodes must not have had the ServiceType Disabled or be BlockListed due to Node’s Pause/Deactivate Status:
FaultDomain:fd:/2 NodeName:_sf**type_2 NodeType:sf**type NodeTypeName:sf**type UpgradeDomain:2 UpgradeDomain: ud:/2 Deactivation Intent/Status: None/None

ReplicaExclusionDynamic — No Colocations with Partition’s Existing Primary or Potential Secondaries:

FaultDomain:fd:/0 NodeName:_sf**type_0 NodeType:sf**type NodeTypeName:sf**type UpgradeDomain:0 UpgradeDomain: ud:/0 Deactivation Intent/Status: None/None

Noticed below health warning event

There was no data from ‘sf**type_2’ post that failing date, so we confirmed both ISS and FabricDCA.exe was crashing
                          N/S RD sf**type_3 Up 131212…946953
                          N/S RD sf**type_1 Up 131212…593463858
                          N/S RD sf**type_4 Up 13121…..3859
                          N/I SB sf**type_2 Down 1312…..63860
                          N/P RD sf**type_0 Up 131212…..61

Event Log

Log Name:      Application
Source:        Microsoft-Windows-PerfNet
Date:          12/9/2016 7:42:40 AM
Event ID:      2005
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      sf***ype00xxx02
Description:
Unable to read performance data for the Server service. The first four bytes (DWORD) of the Data section contains the status code, the second four bytes contains the IOSB.Status and the next four bytes contains the IOSB.Information.

C0000466 00000000 634A41F0
Log Name:      Microsoft-ServiceFabric/Admin
Source:        Microsoft-ServiceFabric
Date:          12/12/2016 11:29:13 AM
Event ID:      59904
Task Category: FabricDCA
Level:         Error
Keywords:      Default
User:          NETWORK SERVICE
Computer:      sf***ype00xxx02

Description:
Failed to copy file D:\SvcFabLogPerformanceCounters_ServiceFabricPerfCounterfabric_counters_6361xxxxx47065191_000940.blg to Azure blob account sf***ype00xxx02, container fabriccounters-2b73743xxxxxxa46d111c4d5.

Microsoft.WindowsAzure.Storage.StorageException: The remote name could not be resolved: ‘sf***ype00xxx02.blob.core.windows.net’ —> System.Net.WebException: The remote name could not be resolved: ‘sf***ype00xxx02.blob.core.windows.net’
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   — End of inner exception stack trace —
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.UploadFromStreamHelper(Stream source, Nullable`1 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
   at FabricDCA.AzureFileUploader.CreateStreamAndUploadToBlob(String sourceFile, CloudBlockBlob destinationBlob)
   at FabricDCA.AzureFileUploader.CopyFileToDestinationBlobWorker(FileCopyInfo fileCopyInfo, CloudBlockBlob destinationBlob)
   at FabricDCA.AzureFileUploader.CopyFileToDestinationBlob(Object context)
   at System.Fabric.Dca.Utility.PerformWithRetries[T](Action`1 worker, T context, RetriableOperationExceptionHandler exceptionHandler, Int32 initialRetryIntervalMs, Int32 maxRetryCount, Int32 maxRetryIntervalMs)
   at FabricDCA.AzureFileUploader.CopyFileToDestination(String source, String sourceRelative, Int32 retryCount, Boolean& fileSkipped)

Check list tried:

  • we checked the free space details of drive “D:/” of this failing node – had enough space.
  • we were able to RDP into the machine (failing node) but could not able to browse any web sites or nslookup any url.
    1. >nslookup sf***ype00xxx02.blob.core.windows.net
    2.   server:unknown
    3.    *** unknown can’t find sf***ype00xxx02.blob.core.windows.net: No response from server
  • logs confirmed that, this particular failing node VM was going through some network related issue which is why it was not able to connect to any of the services and storage account.
  • there were no fabric log post this issue start date which also confirmed this vm lost its connectivity
  • checked any crash dump under D:SvcFabLogCrashDumps – no dumps
    checked the traces from D:SvcFabLogTraces – did not get any hint

Fix/resolution:

  • With above all findings, we confirmed this failing node:_sf***ype_2 was not resolving the DNS for some reason. This issue occurs very rarely due to corruption at OS level.
  • From the registry we see it has received the proper DNS settings from the azure DHCP server. 
  • The “HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParametersDhcpNameServer” was set to 16x.6x.12x.1x” but the affected machine was not able to read and use this DNS configuration due to which name resolution was broken at the operating system.
  • To overcome this issue, we ran “Netsh  int ip reset c:reset.log” and “netsh winsock reset catalog”  to reset the IP stack and windows socket catalog and rebooted the Virtual machine which eventually resolved this issue.

Reference article :https://support.microsoft.com/en-us/kb/299357

Let me know if this helps in someway.

2016-12-18 Posted by | Azure, ServiceFabric, VMSS | , , | Leave a comment

How to RDP into Azure Linux machine using Xrdp

I ran into this issue after creating Azure Linux VM and attempting to configure RDP for the first time. At Linux side, I have installed Xrdp and configured for RDP access. But when I try to RDP from my windows machine then it failed. I spent few hours troubleshooting this issue without clue but later it turned out to be a “port” issue. Yes, by default Azure VM’s will expose or allow very limited port say 80,443 for Windows and in Linux Port 22 for SSH connection. So in order to enable RDP for Linux/Win machines, then you may have to add this port 3389 under “incoming security rules” as below.

image

I followed this blog post for xrdp setup up but nothing specific about Azure port as such. So thought of summarizing my learning here in steps to follow quickly for achieving RDP access to Azure Linux VM’s.

1) Login to new portal (portal.azure.com), Click “+ New” for adding resource, then select Virtual machine. You will find Ubuntu server OS list. Let say pick “Ubuntu Server 14.04.4 LTS”. Make sure to note down the Username, Password and Public IP(PIP) for later reference.

2) Once VM has been created, use Putty.exe to connect to the VM over SSH(Port 22) which is enabled by default. Enter the PIP and hit the connect button. You will get a console asking to enter username and password. Once provided, you will land in Linux terminal where we are going to execute the next set of commands in order.

image

3) Command to Install Desktop and xRDP at Linux VM side.

$ sudo apt-get update

$ sudo apt-get install ubuntu-desktop
$ sudo apt-get install xfce4
$ sudo apt-get install xrdp
$ echo xfce4-session >~/.xsession
$ sudo nano /etc/xrdp/startwm.sh  <attention to the last line, it should be exactly like this>
#!/bin/sh
if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG LANGUAGE
fi
startxfce4
$ sudo service xrdp restart

4) Now go back to Azure portal and Add Port 3389 under Inbound security rule (as in the above screenshot). P.s:- 3389 is well known port used by Azure for RDP.

5) Now from Windows machine, Launch “mstsc” to input VIP and username & password to Xrdp.

ss

 

 

 

 

 

 

P.s:- Clipboard copy not supported here.

I missed the step 4 and wasted quite a lot of time figuring out.

Hope this will save someone’s time 🙂 .

<update:7/21>
               a. Finding the inbound rules is little tricky..
                       VM > settings > network interfaces >settings > NSG > select the NSG > settings > inbound rules
               b. lately noticed our official article on this https://azure.microsoft.com/en-in/documentation/articles/virtual-machines-linux-classic-remote-desktop/

</update:7/21>

Update:8/1 – tips

1) exit ->logout, 2) sudo –  -> (to get into root) 3) sudo passwd root

4) download any .deb (tar xzvf file.tar.gz) extract, check for bin > say check for "sh" file -pycharm.sh, right click > execute

 

<Unsupported: 9/28/2016>

Unsupported: How to install xRDP for GUI remote access on Linux
https://blogs.msdn.microsoft.com/linuxonazure/2016/09/26/unsupported-how-to-install-xrdp-for-gui-remote-access-on-linux/

</Unsupported>

2016-06-30 Posted by | Linux, Open Source, OSS | , | 2 Comments

.NET today, tomorrow and future..

This blog post was drafted few weeks ago but stuck in the same state because I was not sure what to add or write on top of what we learned from our recent dotnetConf2016.  Any how today I decided to wrap this so that it will be useful for readers. This post is mainly written for .NET developer who wanted to know where we are heading as  a community.

 

Motivation:- If you notice in recent times, there is a bunch of articles targeting .NET platform and its future. Few trolled about WPF and Winform roadmap. I saw most of them are one sided and simply trolled comparing with recent programming stack like LAMP/MEAN as an alternate. But the true story is, .NET is not going to go away. This applies to Java as well. I have my good old friends still doing WPF consulting work for big banking companies and happy with that. We all need “Growth Mindset” in looking at them.

We may have to agree that our recent startup companies are going 100% open source but when it comes to desktop development still WPF rules.The skill what you acquired from WPF is not going to be waste, because UWP is based on XAML. .NET is growing and evolving faster than ever. If you look at our .NET Foundation, it has got some fantastic open source projects run by community. We are breaking the platform dependencies, IIS, underlying win32 thick references which is the great thing for cross platform movement.  

 

Technology:- Things are changing very rapidly when it comes to programming side especially for the web & mobile technologies. As we march towards mobile first cloud first world, it makes sense to investment towards platform mobility and in cloud. please note, “mobile first” here is nothing to do with our mobile device. It’s about application mobility – should be able to port our app across the device.

Every week/month we see new set of tools/services/JS framework/scripting things comes out constantly and occupies the head line or top slot in tech conferences. One shouldn’t be worrying about new things, we should stay calm and keep learning at least one new languages every year as an investment. If I remember correctly, for last few years we are seeing a trend in IT requirement. Yr 2013 was for Big data, 2014 for Machine learning/deep learning/AI , 2015 for IoT + dockers,  again in 2016 seeing BoT, headless servers, nano servers, cognitive services and what not. Btw, Cloud and OSS is the constant thing for last few years and going to be more talked in coming years as well Smile. It shouldn’t be a matter for us to pick up this in couple of weekends if we know the fundamentals of programming & design standards.

 

 

Roadmap:- If we know the technology roadmap in advance, then it is easy for anyone to refer and suggest for customers. I had this .NET roadmap guide constantly referred, forwarded to architects for newer design consideration but the last one published was in the year 2013 and sadly no update after that.

Get our last guide “.NET Technology Guide for business applications” downloaded from- > here

[P.s: Some of them are already outdated]

 

clip_image002 

 

Few months back, I reached out to Cesar(author of this PDF) seeking clarity on our guidance update. He has promptly shared the preview version but today I see the same guide available for download freely here. What a timing Smile

Microsoft Platform and Tools for Mobile App Development –

https://blogs.msdn.microsoft.com/microsoft_press/2016/06/22/free-ebook-microsoft-platform-and-tools-for-mobile-app-development/

 

9781509304134_thumb

 

Having said all, Thanks to our recent .net Conference for sharing more clarity around .NET future and developments. If you are .NET developer and not seen the updates from our recent dotnetConf 2016 –  then you are in the right place to get the updates through screenshot.

As title says, this is our current landscape. If you look closer, there is “no code sharing” across the platform and also carry the same learning. The new addition to this slide is our “UWP” and “Xamarin” story.

 

image

 

How about .NET tomorrow:- Yes, it allows us to reuse the skills by mastering one/two library not a platform. You can build and reuse the same code across the platform say iOS or Android or to OSX.

Main objective here is to make the “.NET standard library” to grow without updating platforms. It is going to be decoupled so that you can update libraries as you wish.

 

image

 

How is .NET Future looks like: More and more “.NET standard” supported API’s are expected in few months. Complex Libs like App Domains, Full Reflection and Binary Serialization are also getting considered. In near future, one should be able to easily move the code b/w .NET framework or .NET Core or .Xamarin.

 

image

 

.NET future- sub slide (.NET Framework) :-

a) C# – C#7, VB 15 is the talk of the town

b) Going forward- new version of windows 10,

c) Winforms/WPF  –> Store model

d) Winform/WPF convert to Store apps model, use store to push across the organization

 

image

image

image

 

What others are busy learning..

 

clip_image009

 

Closing note: & Key take away:

 

clip_image011

 

image

 

clip_image014

 

Recommended video:-

.NET Conf Day 1 Keynote – Scott Hunter

.NET Conf Day 2 Keynote – Miguel de Icaza

.NET Conf Day 3 Keynote – Scott Hanselman on The State of .NET

 

Watch the event videos here:-https://channel9.msdn.com/Events/dotnetConf/2016

clip_image015

 

Hope this is useful for you..

<update : 6/28/2016>

Another milestone on developer’s world: .NET Core & ASP.NET Core 1.0 got released at Red Hat DevNation. https://channel9.msdn.com/Events/Linux/DevNation-2016

.NET Home Page http://dot.net/

.NET Documentation https://docs.microsoft.com/en-us/dotnet/

Announcement https://blogs.msdn.microsoft.com/dotnet/2016/06/27/announcing-net-core-1-0/

</update>

2016-06-22 Posted by | .NET, ASP.NET 5, Azure Dev, C#, DevOps, OSS, PaaS, Uncategorized, VS2015 | , , , | 2 Comments

What are Microservices for developers – Part 1

Today’s post is after reading the below book on Microservices and various Service fabric article readings and research. I am planning to break it down into series of blog post explaining Service Fabric and things to learn for developers or architects in coming days hopefully, wish me good luck ;).. Comments welcome.

What is this Microservices and why there is huge fuzz in recent times:-

Microservices are nothing but fine grained SOA offerings. We can say more politely “it does one thing but very well” means without affecting others or waiting something to trigger. It gives lot of freedom for developers more importantly to decide how to use, design, language to choose, platform to run, deploy, scale etc. It decouples from the main deliverable but revolves in satellite mode support with thick coupling.

Let us see one by one:-

1) It help us to develop, deliver as a smaller component services importantly in an agile way. Each of these services can be owned by a smaller team can be fed with 2 Pizza’s team which they call in Amazon (read about 2PT’s) which I picked from this fantastic book.

2) It gives us the freedom to develop and deploy services independently without waiting for the complete release say quarterly release or half yearly release cycle as in monolithic world. The consumer can start seeing the enhancements or features rolled out now and then and enjoy greatly.

3) These Microservices though deployed separately, but it has to be orchestrated together in one way or another to work closely for a bigger applications. It is designed to run as a unique process or service in silos bundled including separate DB to maintain its state values. It communicate with each other services over Web API/Broker messages way of signalling and syncing. By going this way, we make the team into small units owning the end-to end service responsibility focusing and pushing without waiting for a big release day.

4) DevOps role kind of guys comes in here to develop, configure, release, maintain and also monitor these services exposed as an API endpoint or stateless REST API’s or HTTP/XML/TCP/JSON and of course even binary format too. Typical example would be, heavy trafficked eCommerce site like Amazon, the recommendation shown at the bottom of the page would come from one such microservice, payment gateway code logic on another microservice, or themes or catalogue.. so who knows there could be 25+ such microservices supporting the complete portal. These kind of service separation allows the developer guys to evolve quickly and also fix their bugs/changes in real time by updating one after the other. Live example is, amazon.com relies on more than 150+ API’s to render its any of their page.

5) These services can be written in any programming language or using any framework hosted in any platform too. It gives us the choice to decide and roll out quickly with our known languages.

6) It gives us the flexibility to test out these individual services individually for scaling scenarios to sustain black friday sale days kind of sudden burst.

7) As I said earlier, these services do one thing so it has to do well. So having this in mind, developers design them to live and serve for longer time by having newer version side by side. In case of an issue in deployment, we can always redirect to older or newer version in agile way. Most of the steps are carried out through scripts or portals GUI for config changes to act quickly

8) Next important benefit is “resilience“. A typical monolithic application would be deployed in big fat server whereas these microservices would spread across servers or even between different data center also. If one such service goes down, then the request would get served from other available copy to continue the business as usual. It also allow us to “scale out” efficiently with duplicate copies of those critical core services by deploying across servers/VMs/containers. There are open source tools which comes handy to perform these scaling operation. In monolithic design, we can maximum scale up to support the additional load but cannot live in separation- tightly coupled in same basket.

9) List of companies known for using Microservice as an early adaptor are Amazon, Netflix, Twitter, Bluemix, Souldcloud, Google, Azure. In recent times, many many big websites and application has already moved from monolithic to Microservices architecture to reap it benefits. Recently, this area is hotter than Big Data or IoT trend and also players like Google Kubernetes, Mesos/Marathon, Docker Swarm, Amazon ECS, CoreOS Fleet or Rancher, Azure Container Service, Service Fabric etc are there to fill in one or the other form. The Main objective of the Service Fabric is to reduce the complexities in building complex applications using Microservice approach. Definitely Containers and actor based programming model are the examples but as said earlier, this area is going to have more update this year.

10) Microservices are usually designed to function as stateless because stateful is tricky & difficult to design for storing its state maintained. But Service Fabric allows us to build such stateless/stateful service without much effort. Service Fabric is a PaaS system for building highly scalable, distributed applications composed from microservices. It enables an > application runtime, > patching and innovative rolling upgrade > health-model support > all while maintaining local state replication. I will try to cover the rest in next part in detail with hands on. Here is the bunch of links to think through.

Microservices:

  1. Why a microservices approach to building applications? https://azure.microsoft.com/en-us/documentation/articles/service-fabric-overview-microservices/
  2. Virtual Academy: Exploring Microservice Architecture : https://azure.microsoft.com/en-us/blog/virtual-academy-exploring-microservice-architecture/
  3. Provision and deploy microservices predictably in Azure : https://azure.microsoft.com/en-us/documentation/articles/app-service-deploy-complex-application-predictably/
  4. http://www.microservicesweekly.com/ – * highly recommended *

General resources:

  1. Microservices : http://martinfowler.com/articles/microservices.html
  2. Microservices Are Not a free lunch! : http://contino.co.uk/microservices-not-a-free-lunch/
  3. Services, Microservices, Nanoservices – oh my! : http://arnon.me/2014/03/services-microservices-nanoservices/
  4. Micro Service Architecture : https://yobriefca.se/blog/2013/04/29/micro-service-architecture/
  5. Microservice Design Patterns : https://www.voxxed.com/blog/2015/04/microservice-design-patterns/
  6. Microservices: Decomposing Applications for Deployability and Scalability : http://www.infoq.com/articles/microservices-intro

Service Fabric –specific:

  1. Microsoft Azure Service Fabric Architecture : https://channel9.msdn.com/Events/Ignite/2015/BRK3717
  2. Building Resilient, Scalable Services with Microsoft Azure Service Fabric : https://channel9.msdn.com/Events/Ignite/2015/BRK3730
  3. Deploying and Managing Services with Microsoft Azure Service Fabric : https://channel9.msdn.com/Events/Ignite/2015/BRK3478
  4. Service Orchestration with Microsoft Azure Service Fabric : https://channel9.msdn.com/Events/Ignite/2015/BRK3485
  5. Microsoft Azure Service Fabric Actors: The Director’s Cut : https://channel9.msdn.com/Events/Ignite/2015/BRK3476
  6. Microservices: An application revolution powered by the cloud:- https://azure.microsoft.com/en-us/blog/microservices-an-application-revolution-powered-by-the-cloud/
  7. Guide to converting Web and Worker Roles to Service Fabric stateless services – https://azure.microsoft.com/en-us/documentation/articles/service-fabric-cloud-services-migration-worker-role-stateless-service
    Learn about the differences between Cloud Services and Service Fabric before migrating applications. –https://azure.microsoft.com/en-us/documentation/articles/service-fabric-cloud-services-migration-differences/

btw,  As I am writing this, I do see Service Fabric going live or GA (general availability). Worth to check //BUILD2016 events and news about ths same topic for latest happenings https://channel9.msdn.com/Events/Build/2016

happy learning !

2016-04-01 Posted by | Azure, Azure Dev, DevOps, Microservices, PaaS, ServiceFabric | , , , , , | 1 Comment

How to collect Azure Cloud Service(VM) Logs using Powershell

Issue: 

How to collect the “Azure Cloud Services instances(VM) logs” when we are unable to RDP or connection failed for some reason. Infact, we can try when RDP not configured etc. Just in case, If we see RDP working, then we can use this tool in VM directly after logging in- http://dsazure.blob.core.windows.net/azuretools/AzureTools.exe

The below solution is useful when we are unable Remote desktop(RDP) into Azure Cloud Service VM machines.

Solution: 

I am trying to simplify this blog post and also adding those missing script location for quicker reference.

Step 1: Download this <click here> scripts to your c:temp. [ AzureRemotelogcollector.ps1, SetAzureServiceLogCollector.ps1 ]

Step 2: Extract the files to the location say C:temp and update the required details in this file -AzureRemotelogcollector.ps1 { make sure to enter cloud services name, role and more importantly working storage account 🙂 }

Step 3: Launch the Powershell in admin mode ( how to launch any exe in admin mode easily refer here )

Step 4: Run this cmdlet to access your subscription PS C:windowssystem32> Add-AzureAccount 

Step 5: Navigate to our script file location path and then type the filename for execution PS C:temp> .AzureRemotelogcollector.ps1

 

 

Step 6: Now its ready for download. You can use this free tool http://storageexplorer.com/ to download these log files

Let me know if you run into any issues..

Related links:-

Configure your Azure Subscription with the Azure PowerShell Cmdlets. 

Regarding troubleshooting tools- refer Kwill’s blog – here 

P.s: I do not author these scripts. Thanks to this site for hosting this script site


<Updated 4/8/2016: Added screenshot explaining the input params>

error

2016-02-18 Posted by | Uncategorized | , , , , | 2 Comments

10 cool things about .NET Core & ASP.NET 5

Yes, you are reading right – Now .NET is truly cross-platform, open-source technology and as many said, it’s no more grandpa’s .NET

Let us start with CLR, CORE and other dependencies one by one. As of now, there are 3 flavors of CLR available – 1) .NET Framework CLR 2) Mono CLR 3) .NET CoreCLR (cloud optimized/pay as you go).

.NET Core consists of set of libraries called “corefx and small runtime called “coreclr”. 

Then “What actually is .NET Core?”

It is nothing but modular, cross platform and open source implementation of .NET Framework means our application can be targetted to run on windows, Linux, Mac OS X and docker.

Let us further break it down; what is what –

corefx –> repo contains .NET Core foundational lib’s alias CoreFx. Let say classes for collections, console or XML for that matter

coreclr –> repo contains the actual .NET Core runtime alias CoreCLR – base library called mscorlib. It also contains GC, JIT compiler and some of the base .NET data types and low level classes like system.tostring, type etc

dnx –> .NET execution runtime, having the code to bootstrap and run our application. It includes compiling system, SDK tools and the native CLR Hosts

dnvm -> enables you to acquire one or multiple .NET Execution Environments (DNX). DNVM is simply a script, which doesn’t depend on .NET. You can install it via a PowerShell command from a command prompt window

dnu -> tool is responsible for all operations involved with packages in your application { dnu restore / dnu install / dnu publish / dnu pack / dnu build / dnu list }

.NET native –> compiles IL byte code to native machine code (no-JIT’ing), so that when the code is executed, there is only “native” code running. It produces binary directly to the OS to execute –no JIT-ing business or runtime compilation. .NET Native is the set of tools used to build .NET Universal Windows platform (UWP) apps.  a.k.a AOT, Ahead of Time compiler. 

.NET Framework and .NET native is currently supported only on Windows OS. One thing to note here, .NET Native doesn’t require .NET Framework runtime dependencies any more. In particular, if you set the .NET native to true then you do not require run time installed. However it uses the optimized implementation of .NET Core.

1) .NET Core runtime includes the same GC which is available in .NET Framework however it doesn’t have things like App Domain, registry or CAS etc. Best thing above all is; isolation– you are going to pack and ship only the run-time dependencies needed for the execution. Means no other external dependencies or shared components required on the targeted machine. We can deploy locally (side by side). It is also sub-set of .NET Framework. We no need to get the latest .NET for system wide installs. We pull the references which is required only for “our” project – that’s it. More importantly, as I said earlier this eliminates GAC installation or registry or COM dependencies or DLL from a installation path – it’s all gone now. It’s pretty much work within the capsule which gets deployed through Nuget.

2) .NET Core story means Mono? “No”, Mono is an open source implementation of .NET Framework. It is alive and well with a large ecosystem on top. It independent of .NET Core.

3) .NET Core is mostly aimed for server applications– say ASP.NET vNEXT. ASP.NET 5/vNEXT (RC1) – fully open source  expected in Q1* 2016, optimized for modern cloud based applications. You can develop and run them across the platforms. It is great fix for Devops and Cloud Computing. With the level of modular separation, it is going to be the trend in development for Containers based micro services or distributed components maintained and updated separately.

4) ASP.NET 5 is based on a new flexible run-time host. It provides a flexibility to run your application with any of the 3 different run-times – .NET framework, .NET Core and Mono. We can host our ASP.NET 5 on IIS, or any Open Web Interface .NET (OWIN)-based server or our own process or self host.

5) No web.config/app.config settings, global.aspx for asp.net 5, more importantly there is no system.web as like traditional asp.net application. Your web config file is replaced with “Project.json” is our project metadata file which holds all the dependencies and framework to build and run etc.

> Start.cs is main file for our application – It has got a Startup constructor and Configuration-services which adds services to the container

> References – all dependencies of our projects are neatly packaged as nuget pkgs.

aa

6) ASP.NET 5 uses built-in Dependency Injection for configuring Services and Libraries. Admin can patch an application without requiring the application to recompile. More over application is also not locked into a patched version – newer versions which is patched can still be used. DI in ASP.NET 5 is end to end applied through .NET Stack.

7) NuGet as a first class delivery vehicle– Yes, packaging is done using NuGet; – pack what we wanted and distributed as independent package.

8) In case of ASP.NET 5, there is no compilation happens means build step is removed. We can make the changes and refresh the browser for new changes to reflect. The compilation happens automatically after save. It also fully supports side by side support, can be installed without affecting any other applications on the machine.

9) .NET Framework is a machine wide framework. Any changes affects all the application taking the dependency on it where as .NET Core is XCOPY deployable stack. We do not have to get any out of the box run-time installed other than what application bundled with. It minimize the size of the application as well.

Step1) Execute the following command in command prompt under Admin
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}" 
Step2) Dnvm upgrade or Dnvm update-self
Step3) dnvm install -r coreclr latest -u
Step4) dnvm list 
Step5) Create the below code in C:tempHello.cs
 using System;
 public class Program
 {
 public static void Main (string[] args)
 {
 Console.WriteLine("Hello, Windows");
 Console.WriteLine("This is from Windows :) and running over .NET Core");
 }
 }
Step6) Create a project.json under the same folder where our CS file resides
{
 "version": "1.0.0-*",
 "dependencies": {
 },
 "frameworks" : {
 "dnx451" : { },
 "dnxcore50" : {
 "dependencies": {
 "System.Console": "4.0.0-beta-*"
 }
 }
 }
}
Step7) dnu restore
Step8) dnx run

10) As of now, we can build few workloads like 1) Console Application 2) ASP.NET 5 and its services 3) Windows 10 UWP. But things are getting added. Read the future .NET Core road map here

Click the gif

Disclaimer: This is my understanding about this topic read from various official content. Please feel free to correct me if you happen to see mistakes in this post.

 

<Update: 20/1/2016>

ASP.NET 5 is now renamed as ASP.NET Core 1.0

http://www.hanselman.com/blog/ASPNET5IsDeadIntroducingASPNETCore10AndNETCore10.aspx 

</Update>

2015-12-04 Posted by | Uncategorized | , , , , , | Leave a comment

%d bloggers like this: