.NET 2015 - An Overview

2. April 2015 13:00 by Chris in dev, IT Pro  //  Tags:   //   Comments (0)

I’ve just finished catching up with a recording from dotnetconf 2015 (http://www.dotnetconf.net/): http://channel9.msdn.com/Events/dotnetConf/2015/Welcome-and-NET-2015-Overview

I am going to attempt to share and extend the knowledge presented here.

Being a .NET developer has gradually become a more and more complex propositions over the 13+ years since its launch and after viewing the video it is safe to say that it is only getting more complex as Microsoft and others attempt to extend support to a variety of different platforms, among other reasons.

With increments of .NET we are used to getting updates to the .NET languages, the underlying Framework and technologies built on it, such as ASP.NET. With .NET 2015 we have a couple of new .NET variants to get to grips with, and that is just for starters. 

Pass1

.NET 2015 could be summarised as two frameworks, .NET Framework 4.6 and .NET Core 5, both based on underlying shared runtime components, compilers and with intrinsic support from NuGet package management. .NET Core is a rewritten, stripped down version of the .NET Framework better suited to deployment scenarios where the full extent of the .NET Framework is not required.

Pass 2

A slightly fuller list of the constituent elements of .NET 2015 might be:

  • C# 6 (and VB 14)
  • Roslyn (the .NET Compiler Platform) – new(ish) C# and VB compilers, new language features, compiler-as-a-service and open source
  • .NET Framework 4.6
  • ASP.NET 5
    • Which does not support VB.NET or web forms(!)
  • .NET Native
    • An ahead-of-time compiler that compiles apps directly to native code and contains a minimal CLR runtime. Windows Store apps start up to 60% faster and use 15-20% less memory when compiled with .NET Native. 
  • .NET Core 5, as highlighted above but also key is that .NET Core is also supported by Microsoft on Linux and Mac OSX as well as Windows. This is a ‘biggie’.

Wow. Plenty of changes to get our heads around. That’s not everything either.

A related concept that might be new is that of Universal Windows apps which will run on .NET Native (ARM, x86, x64). The concept, or ‘app model’ has actually been around for a little while. It allows code sharing between Windows Phone & Windows apps (8.1+) and are deployed to the Windows Store. Further, Xamarin has plans to support the app model for Android and iOS development.

You might be asking ‘how does the .NET framework client profile fit into all this’, if you are as behind the times as me. The .NET Client Profile is a subset of the .NET Framework, which was provided with .NET Framework 4 and earlier versions and was optimized for client applications. A bit like .NET Core 5 then, but largely not;). Starting with the .NET Framework 4.5, the Client Profile has been discontinued and only the full redistributable package is available.

Microsoft is also making a big deal of a number of the constituent parts of .NET 2015 being open sourced/ community driven. This may well be a big deal but it isn’t something that holds my interest particularly currently as I’m too busy trying to understand what all these parts, how they might fit together and what it means for the industry and me, as a developer!

Pass 3

Let’s have a third pass through .NET 2015 adding a little more flesh. I like Beth Massi’s breakdown of the topic at

http://blogs.msdn.com/b/bethmassi/archive/2015/02/25/understanding-net-2015.aspx and I have blatantly stolen key sections of of her text and interjected my own thoughts below:

Frameworks and Runtimes

The .NET Framework consists of 2 main components: the Common Language Runtime, the execution engine, and the Framework Class Library, which provides a code library developers can build upon.

  • .NET Framework 4.6 is the next full version of the framework as we know it today and will be delivered with Windows Update and with Windows 10.
  • .NET Core 5 is a general purpose, modular framework that can be used across a wide variety of app models and platforms, is available as open source, can be deployed modularly & locally (side-by-side), and will be supported by Microsoft on Windows, Linux and Mac OSX, though is only available for Windows at the time of writing. It is a refactored set of base class libraries (corefx) and runtime (coreclr) which includes a new JIT compiler (“RyuJIT”), the .NET Garbage Collector, native interop and many other .NET runtime components.

Compilers

  • The .NET Compiler Platform ("Roslyn") provides open-source C# and Visual Basic compilers. Roslyn produces platform independent Intermediate Language (IL) and is used when building against .NET 2015, including Framework and Core. There are also key language innovations in both VB and C#.
  • “RyuJIT” is the new default just-in-time (JIT) compiler for .NET on x64. The JIT compiler takes IL and compiles it for the particular machine architecture the first time it is executed at run-time. Used for desktop and server-based scenarios, RyuJIT is an overhaul of the previous 64-bit JIT compiler that significantly reduces startup times.
  • .NET Native compiles C# to native machine code that performs like C++, so developers continue to benefit from the productivity and familiarity of the .NET Framework with the performance of native code. This takes the place of the JIT run-time compilation we are used to.

App Models

App models extend the common libraries of .NET Framework 4.6 and .NET Core 5. Windows Forms, WPF, ASP.NET Web Forms, MVC 5, etc., app models that you are familiar with today are part of the .NET Framework 4.6, come with many new features, as well as benefit from the new innovations in the languages, Roslyn compiler, and RyuJIT. It is important to note that not all these app models and related languages are supported by .NET Core 5, far from it. However, some app models are new and designed to run on the optimized .NET Core 5 only.

ASP.NET 5

I’m primarily a web developer so am particularly interested in ASP.NET. ASP.NET 5 is a lean .NET app model for building modern web apps. It was built from the ground up to provide an optimized development framework for apps that are either deployed to the cloud or run on-premises. Based on user feedback some features have been dropped to ensure ASP.NET 5 is as lean as possible, e.g. web forms and VB support. It includes the MVC 6 framework, which now combines the features of MVC and Web API into a single web programming framework, as well as SignalR 3 - enabling you to add real time functionality. It consists of modular components with minimal overhead, so you retain flexibility while constructing your solutions. Almost all features are now implemented as NuGet modules, allowing you to optimize your app to have just what you need. It also now has built in support for dependency injection, whereas previously you had to rely on 3rd parties.

ASP.NET 5 can run on top of .NET Framework 4.6 or .NET Core 5. Today, ASP.NET 5 uses the Mono runtime to run on Linux and Mac. Once .NET Core supports Linux and Mac, then ASP.NET 5 will move to using .NET Core for those platforms.

 

Right, my head is spinning. Back to the day job until .NET 2015 is released at least.

 

References

http://blogs.msdn.com/b/bethmassi/archive/2015/02/25/understanding-net-2015.aspx
http://www.hanselman.com/blog/IntroducingASPNETVNext.aspx
http://www.dotnetrocks.com/default.aspx?showNum=1121
http://stephenwalther.com/archive/2015/02/24/top-10-changes-in-asp-net-5-and-mvc-6
http://en.wikipedia.org/wiki/.NET_Framework
https://weblogs.asp.net/scottgu/introducing-asp-net-5

Configuring SQL Server to listen on a specific port

26. March 2015 10:17 by Chris in ForTheRecod, IT Pro  //  Tags:   //   Comments (0)

Looking at our SQL Server 2008R2 box, which was exposed to the internet on the default sql server port of 1433, I noticed in the event log we were getting sporadic brute force attacks by bots on various SQL Server user accounts. A quick google indicates that this configuration is just not on. You are just asking for such trouble. I didn't set this box up by the way. I don't think ;) There are articles out there with several recommendations but the key one is move to a different port. The MSDN article on this topic isn't perfectly clear and it does depend on your network setup - configured IP addresses and the like. So here is my quick guide on the matter.

In SQL Server config manager go to to TCP/IP in network config for the server instance and change the TCP port settings to another number - the top end is about 49000 and a few are reserved. Google/ Bing is your friend. The slightly confusing bit, for me, was which to reconfigure port forwarding entries to reconfigure - networking isn't my day job. IP6 looked like the correct option. That didn't work when changed, service restarted and connecting from management studio from another machine - the default port was still working. As I had SQL 2012 on the box as well installed on a different port I compared settings and all its ports were set to the same bar 1 so I did similarly for 2008R", in fact configuring them all to the new port.

I then check management studio again, connecting to the default port on the local network to the machine name and it failed. I tried on the configured port - servername,portno - and that timed out as well BUT I figured this was firewall security. I added an inbound entry for that port in the firewall for TCP and whiel I was there I disabled the existing rule for 1433. Tried again and bingo, I was in. All good.

Next step was to check the sub-domain forwarding on the LAN router set up to direct connections from the internet to the box where the sql server instance resides. Not particularly recalling the config detail at the I hoped this would 'just work', but it didn't ;( SQL Server 'actively refused' the connection. Checking the router config I was reminded that it was port forwarding that was configured for the external static IP so of course this was set to 1433 and had to be modified as well. Then, ... it worked. Joy. The one final test I need to get to is to make sure that connections *actually* external to my LAN can access the SQLServer through the new port. But there is no urgent requirement to do so and I have these notes to return to now if needs must.

I then also cleared all those application event log entries for the brute force attacks and will keep a closer eye on the logs from now on.

This is recorded here in case I need it again but, you never know, it may be of use to someone else!

However, I may not need it again as

a) I'm moving which might mean discarding the current static IP (though I may need to keep that for other work reasons actually), and

b) I should really be using Azure by now anyway!

 

 

ASP.NET on Windows 8.1/ IIS 8.5 (trials and tribulations)

15. January 2014 13:32 by Chris in dev, IT Pro, Windows 8  //  Tags:   //   Comments (0)

When I upgraded my main dev laptop from Win7 to Win8 (then 8.1) I had problems with ASP.NET under IIS. I put off sorting the issue out as I had IIS Express working adequately for development but this was never going to be a long term solution. Hopefully the issue arose due only to my upgrade path but it has come time to sort this out and surely this path must be fairly common?

My first issue was a HTTP Error 500.19 which http://stackoverflow.com/questions/12208209/iis-8-0-asp-net-and-error-500-19 helped with - as per one contributor I had to set Modules also to Read/Write instead of ReadOnly. Next though the site wasn't picking up my default aspx document and, digging further, even though ASP.NET was apparently installed (2.X and 4.X) handler mappings for aspx were notable by their absence (MIME type mappings are not required nowadays as these are just for static types). Oh, as an aside as well the .NET installers don't work on windows 8.1 (the solution google liked) - you must instead enable the Windows feature, not that this worked fully in my case.;( 

To reinforce this with a little detail, the next google hit was http://stackoverflow.com/questions/11319311/mime-types-missing-in-iis-7-for-asp-net-404-17. i.e. manually installing ASP.NET

I tried running 
 
aspnet_regiis.exe -i
 
But I instead received the message that this wasn't supported in this version of windows and that I should instead try one of: turning windows features on and off, the server management tool (N/A) or the dism.exe command line tool.
 
So in lieu of the command line option I next tried uninstalling and installing again (2.X and 4.X) - the thought did occur that this might be just an ASP.NET 3.5 problem, as that was the version of my test site. No joy.  Next, brute force approach and I tried adding all features under ASP.NET under windows features. Still no joy. Then I happened across a response someway down in http://stackoverflow.com/questions/3762287/script-not-served-by-static-file-handler-on-iis7-5 which referred to Windows 8 and hence possibly my problem as there was remarkably little from google on such Windows 8.X/ IIS 8.X issues. This referred to an additional 3.5 setting  within Application Development Features. I had to google again as this is several levels down in the config:
 
 
Got there in the end and it worked for 3.5 though as I'd broken a few things along the way I'm not sure if I'm ready to try 4.X as well!
 
Microsoft sure don't make life easy sometimes!
 

Setting up Skydrive alongside Skydrive Pro

29. August 2013 12:58 by Chris in ForTheRecod, IT Pro  //  Tags:   //   Comments (0)

I imagine many people will be in a similar position to me - they have a main computer which they use for both personal and professional activities. A few less perhaps will have an Office365 account for work they would like to sync their work documents with, whether as another element to their backup strategy or so they can access these same documents from other computers/ devices. Now we all probably know there is the free Microsoft Skydrive service offering for syncing files to the 'cloud' (an overused term but we'll run with it). What some may not know is that their is also Skydrive Pro, which seems to be confusingly named as it is not really the same thing as Skydrive at all but rather ties in with Office 365 SharePoint. Importantly it offers more storage as well (currently 25GB), unsurprisingly as it is a paid for service. Saying that, the free 7GB of Skydrive isn't too shabby and should be ample if you are not storing video up there, which is probably not a good idea for your bandwidth utilisation anyway!

So you could sync all your files to the cloud via Skydrive but if  you in the same situation as me you might prefer the tidy, logical separation of syncing work files to the Microsoft business offering (Skydrive Pro) and personal files with the Microsoft consumer offering (Skydrive).

Here's how I did it:

  • Firstly Skydrive syncs to a folder on your C: drive by default and however much space I allow on my C: drive partition I always seem to start running out of space in the end so before I moved even more docs there I split out my work and personal files (yes, some did overlap - make a call) and created directories on my d: drive for them. Note that my focus was on documents and images (I'm a web developer), not photos or other media - that may come later but I currently have a distinct backup mechanism for these.
  • I had set up Skydrive previously and what was being synced in my Skydrive was legacy from way back when I first set up my "windows live/ Hotmail/ whatever it is called now" account. There is some old spurious stuff in there but I'll leave for now and tidy up in the future. What I needed to do was add my later personal files.
  • I had installed Skydrive before and I needed to repoint at my new folder on D:. Google was my friend and pointed me at reference 1 below - the Skydrive icon in the system tray exposes settings where you can unlink Skydrive. If you then select your existing Skydrive folder it restarts it's setup process and you can repoint it at another location - my new folder.
  • Skydrive is all well and good now, what about Skydrive Pro. Well I found this very confusing in comparison. As Paul points out in his article (2 below) you install and run the client and it comes up with an obtuse dialog asking 'what library do you want to sync?'. What on earth does this mean? Well, as Paul explains (thanks!):

 'If you’re lucky, someone in IT has explained what URL you need there, or maybe you’re just particularly technical. But if not, no worries. There’s a very simple way to get this configured properly. Simply sign into Office 365 on the web and navigate to that SkyDrive link in the toolbar. In the SkyDrive Pro web interface, you’ll see a SYNC button in the upper right corner.' (2)

  • When you press that button it configures your client with the correct URL - yes, your Skydrive Pro storage mechanism is a SharePoint library.
  • You are then given the opportunity to sync to a different directory to the default, which I again chose to keep things tidy on d:. What you don't get is the little clouds icon of the consumer offering replacing the folder icon. The other icons seem to be the same/ similar however.
  • You'll see just the 'Shared with Everyone' folder unless you were using your personal SharePoint library already - which obviously you will want to take care with.
  • I then copied my work documents in to my Skydrive Pro folder and my personal documents into my Skydrive folder.
  • Finally I configured my local Libraries with quick links into both locations.

So great, now any changes are being synced in case of a disaster as well as being available on other devices I own. "What about performance Chris?" Yes, I have my concerns - two extra services pumping data up to the cloud. Seems OK so far but will report back here if I have any issues.

A few hours later I'm back. I'm having problems. I've been through the following cycle a couple of times now:

 

 

 

So I then restart and the Cache then offers to recover the files that were queued by SkyDrive Pro, to which I made the mistake of saying yes a couple of times and my C: drive was filled with GBs of recovered files which are only going to be pushed up to the cloud again by SkyDrive from the local repository. Let's see how many more times I need to go through this loop to get the 7GB of documents up to the server.

30/08

OK, this isn't going well - every time I reboot to clear the Office Upload Centre error it is eating up GBs of my C drive, so much that I am having to reclaim the space. Perhaps there was a better way to push the files up to start with rather than rely on upload centre which seems to be introducing significant overhead.

Ah, others have encountered this issue with the Office Upload Center - see the comments at: http://winsupersite.com/office-365/what-i-use-office-365-and-skydrive-pro. I think maybe I'll give up and dump Skydrive Pro until it is a more mature product. Last straw for me was that one of the listed fixes was only available in Office 2013 and I have 2010 on this machine.

 

 

 References

1 http://www.solveyourtech.com/how-to-unlink-a-local-skydrive-folder/

2 http://winsupersite.com/office-365/office-365-tip-set-skydrive-pro-your-pc

 

 

 

 

.Net 4 500 server error (one explanation)

18. April 2013 09:32 by Chris in dev, IT Pro  //  Tags:   //   Comments (0)

Just a quick note in case others can save the time I wasted on this;( I don't do a huge amount of server config but occasionally I am called to as a web dev, deploying apps to servers.

In this instance I was receiving a 500 server error for an ASP.NET 4.0 website on IIS 7.5 on Windows Server 2008R2. 

 

Nice and helpful. Even better, nothing in the event logs to indicate the problem! It turned out, surprisingly, that this was the first .NET 4 website that had been configured on the box. I had configured all as I normally would, adding a .NET 4 app pool under IIS and assigning this for use by the web site. I thought maybe the .NET 4 installation was corrupt so I did a repair. No joy. Next thought was to manually install .NET 4 but there was no aspnet_regiis in the installation directory. Some googling later suggested the answer was that it was only the client profile of the framework that had been automatically installed to the server and that, in fact, and despite appearances, the full framework required installation; unsurprisingly in retrospect.

So if you hit this issue yourself just google for .NET Framework 4 download or go here. I'm going to install 4.5 now as well while this is all fresh in the mind!

 

 

About the author

I am Dr Christopher Sully (MCPD, MCSD) and I am a Cardiff, UK based IT Consultant/ Developer and have been involved in the industry since 1996 though I started programming considerably earlier than that. During the intervening period I've worked mainly on web application projects utilising Microsoft products and technologies: principally ASP.NET and SQL Server and working on all phases of the project lifecycle. If you might like to utilise some of the aforementioned experience I would strongly recommend that you contact me. I am also trying to improve my Welsh so am likely to blog about this as well as IT matters.

Month List