Wednesday, June 28, 2017

ASP.NET Core IIS error: HTTP error 502.5–Process failure

After enabling .NET Core on my web server I was finally ready to run my ASP.NET Core app. Or at least that was what I thought… When I opened my browser IIS welcomed me with the following error message:

clip_image002

After enabling stdout logging inside the web.config of my ASP.NET Core app I saw following error:

The specified framework 'Microsoft.NETCore.App', version '1.1.2' was not found.

  - Check application dependencies and target a framework version installed at:

      C:\Program Files\dotnet\shared\Microsoft.NETCore.App

  - The following versions are installed:

      1.0.4

      1.1.1

  - Alternatively, install the framework version '1.1.2'.

That is great and meaningful error message. I downloaded the latest runtime version 1.1.2, installed it, and was good to go!

Tuesday, June 27, 2017

Enable .NET Core on IIS

Just a quick reminder for myself. Lost some time last week searching how to be able to run .NET Core apps in IIS on my webserver.

The trick is that you need to install the .NET Core Windows Server Hosting bundle.

  • Install the .NET Core Windows Server Hosting bundle on the hosting system. The bundle will install the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The module creates the reverse-proxy between IIS and the Kestrel server. Note: If the system doesn't have an Internet connection, obtain and install the Microsoft Visual C++ 2015 Redistributable before installing the .NET Core Windows Server Hosting bundle.
  • Restart the system or execute net stop was /y followed by net start w3svc from a command prompt to pick up a change to the system PATH.
  • Create a new Application Pool. Set the .NET Framework version to ‘No Managed Code’.

image

More information: https://docs.microsoft.com/en-us/aspnet/core/publishing/iis

Monday, June 26, 2017

Error when using WebDeploy with ASP.NET Core

Last week I got into trouble when trying to use msdeploy for an ASP.NET Core app. Where I got no problems for the ‘old’ ASP.NET applications, every time I tried to deploy an ASP.NET Core app I got the following error message:

ERROR_USER_UNAUTHORIZED

I logged in on the target server and find a little bit more information in the Event Viewer:

IISWMSVC_AUTHORIZATION_SERVER_NOT_ALLOWED

Only Windows Administrators are allowed to connect using a server connection. Other users should use the 'Connect To Site or Application' task to be able to connect.

clip_image002

I was 100% sure that everything was configured correctly on the server. I used exactly the same steps as for my other applications, the only difference was that this was an ASP.NET Core app.

After some testing, I found an approach that worked for me:

Here are the things I had to change inside my Web Deploy pubxml file:

Friday, June 23, 2017

Visual Studio 2017 - Build Failure. Error: 'path' cannot be an empty string ("") or start with the null character.

After upgrading to Visual Studio 2017 version 15.2, building some of my projects started to fail with the following error message:

Build Failure. Error: 'path' cannot be an empty string ("") or start with the null character.

The problem only appeared for projects where I enabled the lightweight solution loading feature.

Lightweight solution loading:

Many common tasks, such as navigating through your codebase, editing code, and building your projects will not require any projects to be loaded at all. Therefore Microsoft created the lightweight Solution load feature. The effect is that Visual Studio will not fully load projects until you start working with them increasing performance especially for large projects.

As the problem only happened for these projects, I decided to disable Lightweight solution load again. This indeed solved the problem for me(note: I had to close and reopen the solution before I saw an effect).

image

Hopefully a bug fix will be released with the next update…

Thursday, June 22, 2017

Conway’s Law–The original paper

In the context of software architecture, people sometimes talk about Conway’s Law:

Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure.

Although we apply it on software architecture, this definition is originally created in a more broader sense. If you are interested in reading the original paper, go check it out here; http://www.melconway.com/Home/Committees_Paper.html

image

The original paper in PDF format can be found here; http://www.melconway.com/Home/pdf/committees.pdf

Wednesday, June 21, 2017

NPM 5 - Hopes for the future

I’m not a big fan of NPM, it’s not persé the fault of the tool itself but you don’t get happy when you end up with 1000’s of packages and any package change has a ripple effect through your code base. It even gets better when package creators don’t follow the semantic versioning rules and breaking changes appear without a warning. Everything I have to open up a new codebased and NPM starts its magic behind the scenes, it is not without fear that I first start compiling my code.

Sidenote: You can say similar things about any other packaging tool I guess, e.g. NuGet

But hey, enough complaining, time for some good news. Last month, the NPM released version 5 and they promised a lot of improvements.

The announcement:

Starting today, typing `npm install npm@latest -g` will update you to npm version 5.0.1.
npm@5 is all new and packed with performance, reliability, and usability improvements we know you’ll love. These include a new approach to lockfiles, more robust caching, and incredible speed — for many common tasks, npm@5 is up to 5x faster than previous versions.
The update is available now and we recommend it for everyone.
You can learn more about npm@5
here.

Did the update and it is certainly faster! Made my day…

Tuesday, June 20, 2017

Angular 4–Visual Studio 2017 - error TS2420: Class 'MdButton' incorrectly implements interface 'CanDisable'. Property 'disabled' is missing in type 'MdButton'.

After upgrading to Angular 4, my Visual Studio turned red from all the TypeScript errors.

Some samples:

/node_modules/@angular/material/typings/button/button.d.ts(40,22): error TS2420: Class 'MdButton' incorrectly implements interface 'CanDisable'.
  Property 'disabled' is missing in type 'MdButton'.

/node_modules/@angular/material/typings/button/button.d.ts(40,39): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdButtonBase' is not a constructor function type.
The strange thing was, that when I used the Angular CLI and ng build(or serve) no errors appeared and everything seemed to work. 
I first tried to remove my node_modules folder and do a clean install –> didn’t help Sad smile
Then I removed my globally installed node_modules and reinstalled them as well –> didn’t help Sad smile
Then I upgraded my TypeScript version and the related Visual Studio tooling –> didn’t help Sad smile
In the end I found a solution that worked for me here, I had to update to Visual Studio 2017 Update 15.2. I don’t understand why upgrading an Angular version will get Visual Studio into trouble. I hope this experience will improve as I will become hesitant to upgrade Angular in the future.
Remark: Afterwards I noticed that a colleague already sent me an email telling me to update my Visual Studio before upgrading. Better read my mails next time… Confused smile