Lance Larsen - .NET Architect Madison Wisconsin

Needed to add MP4 video support to an ASP.NET website project. 

Found that adding the following made that work great when I deployed to Azure.

<!-- ====================================================================== -->
<!-- Required to have Videos show up when deployed to Azure  -->
<!-- ====================================================================== -->
<staticContent>
  <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>

Alas, when I refreshed the cache on my browser – all of my CSS and Javascript files would not load, with the dreaded 500 errors.

So apparently, as soon as you add any <staticContent> settings – you need to add all possible settings.  Counter intuitive, so wanted to share the a comprehensive non-trivial fix that worked for me.

If there’s a better way to do this – love to hear it…  Also may be a better way to do this in ASP.NET Core – but for now this is a pre-Core project.

Here’s the solution, hope it helps someone else.  Good coding :)

<!-- ====================================================================== -->
<!-- Required to have Videos show up when deployed to Azure  -->
<!-- ====================================================================== -->
<staticContent>
  <!-- Set expire headers to 30 days for static content-->
  <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00"/>
  <!-- use utf-8 encoding for anything served text/plain or text/html -->
  <remove fileExtension=".css" />
  <mimeMap fileExtension=".css" mimeType="text/css; charset=UTF-8" />
  <remove fileExtension=".js" />
  <mimeMap fileExtension=".js" mimeType="text/javascript; charset=UTF-8" />
  <remove fileExtension=".json" />
  <mimeMap fileExtension=".json" mimeType="application/json; charset=UTF-8" />
  <remove fileExtension=".rss" />
  <mimeMap fileExtension=".rss" mimeType="application/rss+xml; charset=UTF-8" />
  <remove fileExtension=".html" />
  <mimeMap fileExtension=".html" mimeType="text/html; charset=UTF-8" />
  <remove fileExtension=".xml" />
  <mimeMap fileExtension=".xml" mimeType="application/xml; charset=UTF-8" />
  <!-- HTML5 Audio/Video mime types-->
  <remove fileExtension=".mp3" />
  <mimeMap fileExtension=".mp3" mimeType="audio/mpeg" />
  <remove fileExtension=".mp4" />
  <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
  <remove fileExtension=".ogg" />
  <mimeMap fileExtension=".ogg" mimeType="audio/ogg" />
  <remove fileExtension=".ogv" />
  <mimeMap fileExtension=".ogv" mimeType="video/ogg" />
  <remove fileExtension=".webm" />
  <mimeMap fileExtension=".webm" mimeType="video/webm" />
  <!-- Proper svg serving. Required for svg webfonts on iPad -->
  <remove fileExtension=".svg" />
  <mimeMap fileExtension=".svg" mimeType="images/svg+xml" />
  <remove fileExtension=".svgz" />
  <mimeMap fileExtension=".svgz" mimeType="images/svg+xml" />
  <!-- HTML4 Web font mime types -->
  <!-- Remove default IIS mime type for .eot which is application/octet-stream -->
  <remove fileExtension=".eot" />
  <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
  <remove fileExtension=".otf" />
  <mimeMap fileExtension=".otf" mimeType="font/otf" />
  <remove fileExtension=".woff" />
  <mimeMap fileExtension=".woff" mimeType="font/x-woff" />
  <remove fileExtension=".crx" />
  <mimeMap fileExtension=".crx" mimeType="application/x-chrome-extension" />
  <remove fileExtension=".xpi" />
  <mimeMap fileExtension=".xpi" mimeType="application/x-xpinstall" />
  <remove fileExtension=".safariextz" />
  <mimeMap fileExtension=".safariextz" mimeType="application/octet-stream" />
  <!-- Flash Video mime types-->
  <remove fileExtension=".flv" />
  <mimeMap fileExtension=".flv" mimeType="video/x-flv" />
  <remove fileExtension=".f4v" />
  <mimeMap fileExtension=".f4v" mimeType="video/mp4" />
</staticContent>

imageWe live in AWESOME times… Hololens + new Mixed Reality Headsets, oh my!

To develop for each of those, you need to keep up with the latest and greatest Unity Betas – download them here…

Want to save my fellow Holonauts some time – if you come across the curious problem where when you go to build and run – you’ll now see that the “Unity C# Projects” checkbox is disabled?!?  That’s not right…

The solution to this is to…

1) Open “Player Settings”
2) Expand “Other Settings”
3) Find “Scripting Backend”
4) You’ll see that the default is now “IL2CPP”, change that to “.NET”

Now your “Unity C# Projects” is re-enabled!

Enjoy and go build some awesome Mixed Reality Apps!

image

imageGreetings my Geeks – we have a lot of awesome ASP.NET Core 2.0 news coming out lately…

As always, sharing is caring – so here you go.

Today – after publishing to Azure – ran the default “Register” user page – and got the error message…

Swapping to Development environment will display more detailed information about the error that occurred.

Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.

imageSo did a search for “ASPNETCORE_ENVIRONMENT” – and found the only references in my project were already set to “Development”…  so that wasn’t it…

imageEventually found a clue that that mentioned Azure App Settings – and yup – that’s where this needs to be set.

So click on your Web App –> Applications Settings –> go down to the “App Settings” section and add the “ASPNETCORE_ENVIRONMENT” and “Development” as displayed in the screen shot.

Now you’ll get the error messages as if you were running it locally – and that should help you resolve your issues.

REMEMBER – before you go to use this in production – revert that change.  Don’t want the bad guys to be able to see any error details.

Good coding!


AB'sTecimageWhile presenting on the Hololens at Twin Cities Code Camp (TCCC) (www.twincitiescodecamp.com) – had the opportunity to do an awesome YouTube interview with AB’sTech (YouTube Channel). 

https://youtu.be/j0uS1MtExfw

Pleasure to get to know you Aaron!  Thanks for the opportunity to speak with you about the Hololens. :)

imageMicrosoft is ecstatic to announce the twentieth anniversary edition of their flagship IDE: Visual Studio 2017!

Join us for a local product launch event on Friday, March 17th at Centare’s Brookfield office. (300 North Executive Drive Suite 300, Brookfield, WI 53005)

Register HERE for Free!

Hear from local technical experts Mitch Muenster (Xamarin), David Pine (C#), Scott Addie (.NET Core) and Lance Larsen (HoloLens) as they showcase what’s new and shiny for developers.  This is a free event sponsored by Microsoft and Centare!

09:00 – 09:50 AM: Xamarin
10:00 – 10:50 AM: .NET Core Tooling
11:00 – 11:50 AM: C# 7
12:00 – 12:50 PM: Lunch
01:00 – 02:00 PM: HoloLens

firefox_2016-02-23_08-46-13-1024x575image

One question I get every time when showing off the Hololens is how long does the battery last?

The quantitative engineer in me wanted a precise answer, so wore the Hololens until the battery died (general usage) – recorded times and % battery… 

Definitive answer ~4 hours, 13 minutes!

imageVery proud to have been recognized as a Microsoft MVP this past year!

I love growing the local and regional developer community.

Also love contributing to Hololens development and outreach.

To stay an MVP, we must continue to push ourselves – and demonstrate what we do regularly.

Found this Chrome ‘MVP Activity Tracker’ plugin for Chrome – that makes that super simple, and wanted to share with fellow MVPs… :)

Check out my MVP Profile!

//Lance

imageMicrosoft is creating some very cool “Cognitive Services” that we as developers can easily utilize in our applications to accomplish some amazing results with a few simple calls to these Azure service.

If you haven’t setup the Cognitive Services – take a look at Setting up Azure Cognitive Services.

We’ll start with the “Face [Detection] API

“Detect one or more human faces in an image and get back face rectangles for where in the image the faces are, along with face attributes which contain machine learning-based predictions of facial features. … The face attribute features available are: Age, Gender, Pose, Smile, and Facial Hair…” 

As my eventual goal is to integrate these into Hololens for you guys – we’ll be doing this integration into UWP (Universal Windows Platform) – but starting with desktop apps.

Completed project is up on GitHub @ FaceApiUwp

Ok, let’s dive right into code!  Fire up Visual Studio…

Read more

Image result for chicago code campimageimageimage

All currently are open for “Call for Speakers” so get your submissions in now!  Looking forward to seeing everyone at each!

unnamedI’m fortunate to be at the forefront of Augmented and Virtual Reality development – combining that with my years of contacts from running the awesome MADdotNET (Madison’s .NET User Group) – makes it possible to do Corporate Outreach on a regular basis.

Excited to head out to talk to one of my favorite companies NRC (New Resource Consulting) on Feb. 23rd.

Have some phenomenal Hololens development information to pass on – and hope to excite some new developers to push the boundaries of what they know and where they are going…

Augmented Reality is the future.

//Lance :)