Friday, April 21, 2017

Use Swagger-UI to test your Open API

In case your REST api exposes an Open API specification document, but you didn’t integrate Swagger UI to allow developers to browse and test your API, they can still use the Swagger-UI capabilities by directly browsing to and put the url in the box at the top of the page. Alternatively, they can add the url of the service to the end with ?url= such as


Thursday, April 20, 2017

ASP.NET Core Web Deploy–XML Documentation files are not copied

After deploying our ASP.NET Core application using Web Deploy, we noticed a problem with our Swagger integration through SwashBuckle. Normally SwashBuckle can integrate documentation in your Swagger UI by extracting and reading the XML comments added to your code.

Problem was that when this XML isn’t copied Swashbuckle throws an exception making our whole API unavailable. Some research showed that the problem appeared after migrating from the project.json format back to csproj, after which the <DocumentationFile> was no longer automatically copied to the output folder during the build or publish process.

The solution I used was to add the following snippet to your csproj:

Wednesday, April 19, 2017

TFS Release error - WinRM cannot complete the operation.

After creating a release pipelin in Team Foundation Server, I got the following error during deployment: 
Connecting to remote server failed with the following error message : WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.
As the error mentions first thing to check if I can use WinRM to invoke Powershell remotely. Therefore login on the target server and execute the following command:
  • winrm quickconfig


  • I said yes to apply the suggested changes


And indeed, no exception was configured on the firewall to allow access from remote computers. The winrm quickconfig did all the work for me to fix the situation. Nice!

Tuesday, April 18, 2017

ASP.NET Core 1.1 –Error in Response Caching Middleware

After putting a first version of our ASP.NET Core application into acceptance, we got a strange bug back.

Sometimes after a cold start, users mentioned that the dropdown lists inside the application were empty. The application is using the Response Caching middleware to prevent having to fetch those lists over and over again from the database.

When looking at the server logs, we found the following error message:

exception": "System.ArgumentException: An item with the same key has already been added. Key: \r\n at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(Object key)\r\n at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add)\r\n at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value)\r\n at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameResponseHeaders.AddValueFast(String key, StringValues value)\r\n at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameHeaders.System.Collections.Generic.IDictionary<System.String,Microsoft.Extensions.Primitives.StringValues>.Add(String key, StringValues value)\r\n at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameHeaders.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,Microsoft.Extensions.Primitives.StringValues>>.Add(KeyValuePair2 item)\r\n at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.d__10.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()\r\n at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.d__11.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---

Seems there is a bug in the Response Caching Middleware, the response caching middleware is causing an exception when it tries to add the same header. This is a bug that should be fixed in  the ASP.NET Core 1.1.1 patch.

Monday, April 17, 2017


Last year our CEO gave a session about ‘Business Model You’, or how to create your personal business model canvas. I really liked the session and how it made you think about your strenghts, weaknesses and the value you create for your company and customers.

I’m still using this approach today. Last week I found Canvanizer, a free tool that simplifies the creation of a Business Model canvas.


Friday, April 14, 2017

Using the Visual Studio 2017 Offline Installer

Visual Studio 2017 offers a new installation experience with better modularity, a smaller footprint and quicker results.

As a consequence, you no longer have a big ISO file containing all possible components, instead you get a small exe and all other files are downloaded on the fly.

Visual Studio 2017 setup dialog

Works great unless you need to install Visual Studio when you don’t have Internet access. An offline installer can be created by following the steps as described here:

Afterwards you can copy the generated offline installer(some executables and a large list of packages) to the location where you want to use it. What is really important is that you first install the provided certificates(they are in the Layout\Certificates folder). The certificates don’t have a password, so just keep clicking next until the installation completes. If you don’t install the certificates first, we noticed that the installer still tries to go online to download the packages.

Afterwords you can run the installation exe.

Thursday, April 13, 2017

Angular CLI–Include a static html file

While integrating OIDC into my Angular app, I had to add a separate authentication page(originally named auth.html). However after bundling and serving my application using ‘ng serve’ I noticed that I couldn’t reach my ‘auth.html’ file and I got an error message instead…

The solution was obvious, any extra files you want to include should be added to the assets section inside the angular-cli.json file: