Friday, May 19, 2017

VS Code–Angular Language Service

Yesterday while listening to the Adventures in Angular Podcast, I heard someone mention the Angular Language Service extension for VS Code.

From the documentation:

This extension provides a rich editing experience for Angular templates, both inline
and external templates including:

  • Completions lists
  • AOT Diagnostic messages
  • Quick info
  • Go to definition

demo

Thursday, May 18, 2017

Improve performance of your ASP.NET Core application

ASP.NET Core is running on Kestrel, ASP.NET Core’s internal web server. Although really fast Kestrel is not a full blown web server. The idea is that you put another web server(on Windows typically IIS) in front of it that acts as a proxy and forwards the requests to Kestrel.

To get this working in IIS, an AspNetCoreModule exists that achieves this goal. Here is the web.config that configures all of this:

If you look at the configuration, you see that by default all request(path="*" verb="*") are forwarded to Kestrel. This isn't ideal because Kestrel is a lot slower in handling static files than IIS.

A better solution is to only forward the requests that should be handled by ASP.NET Core(by example; path="api/*" verb="*") and let other requests be served by IIS.

The magic trick is to use IIS URL Rewrite rules to forward requests to the wwwroot folder of your ASP.NET Core app:

UPDATE: Rick Strahl did a more complete blog post where he took this approach a few steps further: https://weblog.west-wind.com/posts/2017/Apr/27/IIS-and-ASPNET-Core-Rewrite-Rules-for-AspNetCoreModule

Wednesday, May 17, 2017

Visual Studio Live! Videos

Over the years Visual Studio Live! delivered a lot of great content around the globe. On the Visual Studio Magazine blog, you find an overview of all keynotes. Certainly worth checking out…

One of my favorite sessions - Zero to DevOps with VSTS:

Tuesday, May 16, 2017

Visual Studio 2017–Convert to interpolated string refactoring

C# 6 introduces the concept of string interpolation allowing to use expressions inside your string literals providing a type safe alternative to string.format.

Last week I noticed a related refactoring option in VS 2017; when you have an existing string.format statement Visual Studio allows you to convert it to an interpolated string.

Nice!

clip_image002

Monday, May 15, 2017

No assembly found containing an OwinStartupAttribute

After switching to Visual Studio 2017, one of the projects we were working on started to fail with the following error message:

The following errors occurred while attempting to load the app.

- No assembly found containing an OwinStartupAttribute.

- No assembly found containing a Startup or [AssemblyName].Startup class.

To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.

To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.

In our case we don’t need the OWIN startup detection, so we followed the suggestion as mentioned in the error message and updated our config to:

<appSettings>

       <add key="owin:AutomaticAppStartup" value="false" />

</appSettings>

Strange that we didn’t had this problem before VS 2017…

More information:

Friday, May 12, 2017

Take a look into what’s coming next on Azure–The Azure Preview portal

After the “classic” Azure Portal and the “current” Azure Portal, it’s time to introduce a 3th portal, the PREVIEW portal. The Preview Portal allows you to access Azure Portal features before they are released to the main Azure Portal. This enables a sort of “Insider Preview” for just the Azure Portal.

You can access the Azure “Preview” Portal by visiting http://preview.portal.azure.com

image

Thursday, May 11, 2017

ASP.NET core–Log errors to disk

Quick tip if your ASP.NET core application is crashing and you cannot figure out why.

Inside the web.config of the IIS hosting process, change the configuration. Set the sdtoutLogEnabled property to true and specify a location where to output the logs using the stdoutLogFile property.

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>

Remark: I noticed that I had to create the logs folder first otherwise no files were written to this location…