Subscribe: Latest Microsoft Blogs
Added By: Feedage Forager Feedage Grade B rated
Language: English
app  application  azure  core  eto forms  luxafor  net core  net  new  node luxafor  node  preview  run  service  site 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Latest Microsoft Blogs



BlueMilk is Ready for Early Adopters

Fri, 16 Mar 2018 05:35:48 GMT

Jeremy Miller announces the availability of BlueMilk, a new OSS Inversion of Control tool he's building specifically for usage in Jasper applications, but is also a high performing replacement for...

Media Files:

Cross-platform GUIs with open source .NET using Eto.Forms

Fri, 16 Mar 2018 00:53:10 GMT

This is one of those "Did you know you could do THAT?" Many folks have figured out that C#/F#/.NET is cross-platform and open0source and runs on basically any operating system. People are using it to create micro services, web sites, and webAPI's all over. Not to mention iPhone/Android apps with Xamarin and video games with Unity and MonoGame. But what about cross platform UIs? While not officially supported by Microsoft - you can do some awesome is how Open Source is supposed to work! Remember that there's a family of .NET Runtimes now, there's the .NET Framework on Windows, there's xplat .NET Core, and there's xplat Mono. Eto.Forms has been in development since 2012 and is a cross-platform framework for creating GUI (Graphical User Interface, natch) applications with .NET that run across multiple platforms using their native toolkit. Not like Java in the 90s with custom painted buttons on canvas. It's being used for real stuff! In fact, PabloDraw is an Ansi/Ascii text editor that you didn't know you needed in your life. But you do. It runs on Windows, Mac, and Linux and was written using Eto.Forms but has a native UI on each platform. Be sure to check out Curtis Wensley's Twitter account for some cool examples of what PabloDraw and Eto.Forms can do! OS X: MonoMac or Xamarin.Mac (and also iOS via Xamarin) Linux: GTK# 2 or 3 Windows: Windows Forms (using GDI or Direct2D) or WPF Here's an example Hello World. Note that it's not just Code First, you can also use Xaml, or even Json (.jeto) to layout your forms!using Eto.Forms;using Eto.Drawing;public class MyForm : Form{ public MyForm () { Title = "My Cross-Platform App"; ClientSize = new Size(200, 200); Content = new Label { Text = "Hello World!" }; } [STAThread] static void Main() { new Application().Run(new MyForm()); }}Or I can just File | New Project with their Visual Studio Extension. You should definitely give it a try.Even on the same platform (Windows in the below example) amazingly Eto.Forms can use whatever Native Controls you prefer. Here's a great example zip that has precompiled test apps.Once you've installed a new version of Mono on Ubuntu, you can run the same sample as Gtk3, as I'm doing here in a VM. AMAZING.Here's some example applications that are in the wild, using Eto.Forms:MonoGame Pipeline Tool - Content manager for MonoGame Manager - Accounting Software PabloDraw - Character based drawing application JabbR.Desktop - JabbR client Notedown - Note taking application Eto.Test - Application to test the functionality of each widget DotImaging.UI - Portable UI elements for DotImagingThere's so much cool stuff happening in open source .NET right now, and Eto.Forms is actively looking for help. Go check out their excellent Wiki, read the Tutorials, and maybe get involved!Sponsor: Get the latest JetBrains Rider for debugging third-party .NET code, Smart Step Into, more debugger improvements, C# Interactive, new project wizard, and formatting code in columns.© 2017 Scott Hanselman. All rights reserved.      [...]

Adding HTTP Headers to improve Security in an ASP.NET MVC Core application

Thu, 15 Mar 2018 05:34:43 GMT

Damien Bowden shows how to add headers in a HTTPS response for an ASP.NET Core MVC application.

Media Files:

Upgrading a 10 year old site to ASP.NET Core's Razor Pages using the URL Rewriting Middleware

Wed, 14 Mar 2018 05:41:56 GMT

Scott Hanselman begins to upgrade his popular podcast site to ASP.NET Core Razor Pages, merging the old and the new with ASP.NET Core's URL rewriting middleware.

Media Files:

Setting up Application Insights took 10 minutes. It created two days of work for me.

Tue, 13 Mar 2018 06:01:10 GMT

I've been upgrading my podcast site from a 10 year old WebMatrix site to modern open-source ASP.NET Core with Razor Pages. The site is now off the IIS web server and  running cross-platform in Azure. I added Application Insights to the site in about 10 min just a few days ago. It was super easy to setup and basically automatic in Visual Studio 2017 Community. I left the defaults, installed a bit of script on the client, and enabled the server-side profiler, and AppInsights already found a few interesting things. It took 10 minutes to set up App Insights. It took two days (and work continues) to fix what it found. I love it. This tool has already given me a deeper insight into how my code runs and how it's behaving - and I'm just scratching the service. I'll need to do some videos and/or more blog posts to dig deeper. Truly, you need to try it. Slow performance in other countries I could fill this blog post with dozens of awesome screenshots of the useful charts, graphs, and filters that I got by just turning on AppInsights. But the most interesting part is that I turned it on really expecting nothing. I figured I'd get some "Google Analytics"-type behavior. Then I got this email: Huh. I had set up the Azure CDN at to handle all the faces for each episode. I then added lazy loading so that the webite only loads the images that enter the browser's viewport. I figured I was pretty much done. However I didn't really think about the page itself as it loads for folks from around the world - given that it's hosted on Azure in the West US. Ideally I'd want the site to load in less than a second, but this is my archives page with 600 shows so it's pretty heavy. Yuck. I have a few options. I could pay and load up another copy of the site in South Asia and then do some global load balancing. However, I'm hosting this on a single small (along with a dozen other sites) so I don't want to really pay much to fix this. I ended up signing up for a free account at CloudFlare and set up caching for my HTML. The images stay the same. served by the Azure CDN. Fixing Random and regular Server 500 errors I left the site up for a while and came back later to a warning. You can see my site availability is just 93%. Note that there's "2 Servers?" That's because one is my local machine! Very cool that AppInsights also (optionally) tracks your local development server as well. When I dig in I see a VERY interesting sawtooth pattern. Pro Tip - Recognizing that a Sawtooth Pattern is a Bad Thing (tm) is an important DevOps thing. Why is this happening regularly? Is it exactly regularly (like every 4 hours on a schedule?) or somewhat regularly (like a garbage collection issue?) What do these operations have in common? Look closely. It's not a GET it's a HEAD. Remember that HTTP Verbs are more than GET, POST, PUT, DELETE. There's also HEAD. It literally is a HEADer call. Like a GET, but no body. HTTP HEAD - The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. I installed HTTPie - which is like curl or wget for humans - and issue a HEAD command from my local machine while under the debugger.C:>http --verify=no HEAD https://localhost:5001HTTP/1.1 500 Internal Server ErrorContent-Type: text/html; charset=utf-8Date: Tue, 13 Mar 2018 03:41:51 GMTServer: KestrelOk that is bad. See the 500? I check out AppInsights and see it has the full call stack. See it's getting a NullReferenceException as it tries to Render() the Razor page?It turns out since I'm using Razor Pages, I have implemented "OnGet" where I do my data base work then pass a model to the pages to generate HTML. However, if someone issues a HEAD, then the pages still run but the local data work never happened (I have no OnHead() call). I have a few options here. I could handle HEAD myself. I could no-op it, but that'd be a lie.THOUGHT: I think this behavior is sub-optimal. While GET and POST are[...]

Use Ajax To Perform CRUD Operations In ASP.NET Core Razor Pages

Tue, 13 Mar 2018 05:17:55 GMT

Bipin Joshi illustrates how to develop a Razor Page that performs CRUD operations using Ajax calls.

Media Files:

Blazor: a technical introduction

Mon, 12 Mar 2018 05:15:24 GMT

Steve Sanderson provide some deeper technical details for those interested in how Blazor, a framework for browser-based applications written in .NET, running under WebAssembly, actually works.

Media Files:

Upgrading my podcast site to ASP.NET Core 2.1 in Azure plus some Best Practices

Sat, 10 Mar 2018 08:28:43 GMT

I am continuing to upgrade to podcast's site. Today I upgraded it to .NET Core 2.1, keeping the work going from my upgrade from "Web Matrix WebPages" from last week. I upgraded to actually running ASP.NET Core 2.1's preview in Azure by following this blog post. Pro Tip: Be aware, you can still get up to 10x faster local builds but still keep your site's runtime as 2.0 to lower risk. So there's little reason to not download the .NET Core 2.1 Preview and test your build speeds. At this point the podcast site is live in Azure at Now that I've moved off of the (very old) site I've quickly set up some best practices in just a few hours. I should have taken the time to upgrade this site - and its "devops" a long time ago. Here's a few things I was able to get done just this evening while the boys' did homework. Each of these tasks were between 5 and 15 min. So not a big investment, but they represented real value I'd been wanting to add to the site. Git Deploy for Production The podcast site's code now lives in GitHub and deployment to production is a git push to master. A "deployment slot" for staging Some people like to have the master branch be Production, then they make a branch called Staging for a secondary staging site. Since Azure App Services (WebSites) has "deployment slots" I choose to do it differently. I deploy to Production from GitHub, sure, but I prefer to push manually to staging rather than litter my commits (and clean them up or squash commits later - it's just my preference) with little stuff. I hooked up Git Deployment but the git repro is in Azure and just for deploy. Then "git remote add azure ..." so when I want to deploy to staging it's:git push stagingI use it for testing, so ya, it could have been test/dev, etc, but you get the idea. Plus the Deployment Slot/Staging Site is free as it's on the same Azure App Service Plan. A more sophisticated - but just as easy - plan would be to push to staging, get it perfect then do a "hot swap" with a single button click.Deployment Slots can have their own independent settings if you click "Slot Setting." Here I've set that this ASPNETCORE_ENVIRONMENT is "Staging" while the main one is "Production." The ASP.NET Core runtime picks up that environment variable and I can conditionally run code based on Environment. I run as "Development" on my local machine. For example:if (env.IsDevelopment()){ app.UseDeveloperExceptionPage();}else{ app.UseExceptionHandler("/Error");}Don't let Google Index the Staging Site - No RobotsYou should be careful to not let Google/Bing/DuckDuckGo index your staging site if it's public. Since I have an environment set on my slot, I can just add this Meta Robots element to the site's main layout. Note also that I use minified CSS when I'm not in Development. Require SSL Making the whole ASP.NET Core site use SSL has been on my list as well. I added my SSL Certs in the Azure Portal that added RequreHttps in my Startup.cs pretty easily. I could have also added it to the existing IISRewriteUrls.xml legacy file, but this was easier and faster.var options = new RewriteOptions().AddRedirectToHttps();Here's how I'd do via IIS Rewrite Middleware, FYI: Application Insights f[...]

ASP.NET Core Authentication Lab

Fri, 09 Mar 2018 05:12:45 GMT

Barry Dorrans shares a walk-through for a ASP.NET Core Authentication Lab, targeted against ASP.NET Core 2.0 RTM and VS2017/VS Code.

Media Files:

Exploring the ApiControllerAttribute and its features for ASP.NET Core MVC 2.1

Thu, 08 Mar 2018 05:10:31 GMT

Filip Wojcieszyn takes a look at ApiControllerAttribute and how can it help with writing Web APIs.

Media Files:

Replacing Luxafor's App with OSX Automator and Keyboard Shortcuts

Thu, 08 Mar 2018 01:10:12 GMT

A couple years ago, we invested in Luxafor flag lights for everyone on the team. These lights are attached to our monitors and we communicate with each other using them. If someone's light is green, they are "free" and you're welcome to drop by and interrupt what they're doing. If someone's light is red, they are in do-not-disturb mode for one reason or another. They might be on a zoom call or they might just not want to be interrupted.The Luxafor lights come with an app that can control your flag light all sorts of ways. There are animated patterns. There's a pomodoro mode. It can integrate with other services to automatically set your color. And it can (sort of) let you program OS-wide keyboard shortcuts to set the flag color. When we first got our lights, this worked flawlessly. But Luxafor's app has degraded in stability over time and the keyboard shortcuts have taken a big hit. For many months, I've been unable to set up a shortcut for setting the flag to green. And my flag defaults to red whenever I disconnect and reconnect it. Since all we use the flags for is toggling between red and green, this regression has been painful.I've pleaded with Luxafor to fix the critical bug of keyboard shortcuts being broken. I've heard nothing back. It's time to cut out the middle man. Here's what I wanted:An OS-wide shortcut that sets the light to green (^⌥⌘G)An OS-wide shortcut that sets the light to red (^⌥⌘R)For these shortcuts to reliably work every time I use themNo need to launch an app or click anything in the UII didn't feel like this was asking too much, but it took a little time to get it figured out. Thankfully, Matt Goucher had already published a node-luxafor package to NPM that did all of the heavy lifting. With that in place, all I needed to do was:Write a CLI over top of node-luxaforFind a way to run the CLI from an OSX keyboard shortcutThe Node Luxafor CLII created node-luxafor-cli as a thin CLI wrapper around node-luxafor. Right now, it's just js files that can be invoked with node.node green - sets the flag color to greennode red - sets the flag color to rednode index --color=blue - sets the flag color to bluenode index -r 255 -g 255 -b 255 - sets the flag color to whiteThis package has plenty of room for maturation, but it gives me all I needed to start.Keyboard ShortcutsThe keyboard shortcuts were where I had the most to learn. Here's what was involved:Create Automator Services that run Shell Scripts to invoke node and run the node-luxafor-cli scriptsConfigure Keyboard Shortcuts to run the Automator ServicesAutomator ServicesAn Automator Service can register an application in application menus. With the right configuration, the service can be registered to be available in the menu of any application.Here are the steps to create the Automator Services for Luxafor-Red and Luxafor-Green.git clone Automator.appChoose "Service" as the type of documentSelect that the "Service receives: in "Select "Run Shell Script" from the actions library and drag it into the surfaceEnsure an appropriate Shell is selectedIn the script box, put in the equivalent of "node node-luxafor-cli/green", but you will need to provide your full path for node as well as the full path for where you cloned node-luxafor-cli - for me, it was /Users/jeffhandley/.nvm/version/node/v8.9.3/bin/node /Users/jeffhandley/code/node-luxafor-cli/greenPress the Run button to test the service - your light should turn greenSave the service as Luxafor-Color-GreenWith this Automator Service created, follow the same steps to create one for setting the light to red.Keyboard ShortcutsThis was finicky to figure out, but it turns out the biggest catch was how the Automator script was created. It must be a Service and it must be configured[...]

Public preview of Java on App Service, built-in support for Tomcat and OpenJDK

Wed, 07 Mar 2018 09:00:15 Z

A couple of months back, we announced the general availability of App Service on Linux, starting with support for .NET Core, Node, Ruby, PHP, and custom Docker containers. Today, we are glad to…

Major build speed improvements - Try .NET Core 2.1 Preview 1 today

Wed, 07 Mar 2018 06:52:00 GMT

Head over to the main .NET Core download page and pick up .NET Core 2.1 - Preview 1. The SDK contains the tools you need to build and run apps with .NET Core and supports Mac, Windows, Ubuntu, Debian, Fedora, CentOS/Oracle, openSUSE, and we even have Docker images for Stretch, Alpine, and more. It's not your grandmother's Microsoft. ;) Once you've installed it, from a prompt type "dotnet" and note a few new built-in switches:C:\Users\scott> dotnetUsage: dotnet [options]Usage: dotnet [path-to-application]Options: -h|--help Display help. --version Display the current SDK version. --list-sdks Display the installed SDKs. --list-runtimes Display the installed runtimes.path-to-application: The path to an application .dll file to execute.I'll run it again twice with --list-sdks and --list-runtimes:C:\Users\scott> dotnet --list-sdks2.1.300-preview1-008174 [C:\Program Files\dotnet\sdk]2.1.4 [C:\Program Files\dotnet\sdk]C:\Users\scott> dotnet --list-runtimesMicrosoft.AspNetCore.All 2.1.0-preview1-final [C:\Program Files\dotnet\shared]Microsoft.AspNetCore.App 2.1.0-preview1-final [C:\Program Files\dotnet\shared]Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared]Microsoft.NETCore.App 2.1.0-preview1-26216-03 [C:\Program Files\dotnet\shared]There's a few interesting things happening here. Youc an see before I had the runtime for .NET Core 2.0.5, and now I also have the 2.1.0 Preview.It can also be a little confusing that the SDK and Runtime sometimes have different versions, similar to JREs and JDKs. Simply stated - the thing that builds sometimes updates while then thing that runs doesn't. So the .NET Core SDK and compilers might get fixes but the runtime doesn't. I'm told they're going to line things up better. You can read deeply on versioning if you like.You'll also notice AspNetCore.App, which is a metapackage (package of packages) that's got less than All and helps you make smaller apps.If you install a beta or preview you might be worried it'll mess stuff up. It won't. You can type "dotnet new globaljson" and make a file that looks like this! Then "pin" the SDK version you want to use:{ "sdk": { "version": "2.1.300-preview1-008174" }}I'll change this to .NET Core's older SDK and try building the .NET Core based Gameboy Emulator in my last post. It's amazing.Let's see how fast it builds today on .NET 2.0:C:\github\Retro.Net> Measure-Command { dotnet build }Milliseconds : 586Ticks : 65864065TotalSeconds : 6.5864065TotalMilliseconds : 6586.4065Ok, about 6.5 seconds on my Surface. Let's make the SDK version the new .NET Core 2.1 Preview 1 - it has a bunch of build speed improvements. All I have to do is change the global.json file. Update the sdk version in the global.json and type "dotnet --version" to see that it took.I can have as many .NET Core SDKs as I like on my machine and I can control what SDK versions are being used on a tree by tree basis. That means you CAN download .NET Core 2.1 and not mess things up if you're paying attention.C:\github\Retro.Net> Measure-Command { dotnet build }Milliseconds : 727Ticks : 27270864TotalSeconds : 2.7270864TotalMilliseconds : 2727.0864Hey it's less than 3 seconds. 2.7 in fact! More than twice as fast.The bigger the app, the faster incremental builds should be. In some cases we will see (by release) 10x improvements.It's quick to install (and quick to uninstall) and you can control the SDK version (list them with "dotnet --list-sdks") with the global.json.Please go download the preview and let me know either on Twitter or in the comments what your before and after build times are!Sponsor: Unleash a faster Python! Supercharge your applications performance on future f[...]

Securing an ASP.NET Core MVC application which uses a secure API

Wed, 07 Mar 2018 05:51:46 GMT

Damien Bowden uses OpenID Connect Hybrid flow to secure an ASP.NET Core MVC application which uses an API to retrieve data.

Media Files:

ASP.NET Core Anatomy – How does UseStartup work?

Tue, 06 Mar 2018 05:49:06 GMT

Steve Gordon does a deep dive into how UseStartup results in Startup methods being registered and executed.

Media Files: