WCF – Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding

3 things to check,

1. Make sure you are using full IIS and not IIS Express – IIS Express doesn’t support the NetTcpBinding.

2. Make sure you have the Windows Communication Foundation Non-Http Activation Windows component installed – go to Control Panel. Select ‘Add Remove Windows Components’. At the top of the list you will see .NET Framework 3.5 (includes .NET 2.0 and 3.0)

Expand this out and tick Windows Communication Foundation Non-Http Activation.

Confusingly this also enables non-http activation for .NET 4.0 and 4.5.x applications.

If you are using 4.6, expand out .NET Framework 4.6 Adanced Services -> WCF Services and select TCP Activation.

3. Make sure you have enabled the net.tcp protocol in IIS. Open IIS Admin. Select the Website and click on Advanced Properties. Under ‘Enabled Protocols’, add net.tcp (so for http and net.tcp activation, you would have http,net.tcp)

Breeze, Require, and Knockout

If you load Breeze using Require and AMD, AMD looks for a module named ko

As is recommended best practice, knockout registers with require anonymously (i.e. using the filename as the module name).

So if your knockout file is knockout.js and you try to load Breeze via AMD, Breeze wont be able to find knockout.

The two options are,

Rename knockout.js to ko.js

Include the following map in your Require config,

psake, .NET 4.5.2 and MSBuild

At the time of writing (December 2014), the latest version of psake (4.4) defaults to the .NET framework 4 if you don’t explicitly set a framework at the top of your build scripts.

Due to the the peculiar way Microsoft setup MSBuild for .net 4.5.x, this means that psake fails with the following error if you try to build a solution that targets 4.5.1 or 4.5.2.

You have to explicitly set the ‘Framework’ variable to 4.5.1 at the top of the file to make psake use the correct version of msbuild.

Note that using the value 4.5.1 also works for projects that target 4.5.2 (the value 4.5.2 is not recognised by psake).

How to view EntityValidationErrors in Visual Studio

If Entity Framework throws a validation exception when saving, Visual Studio reports the message,

Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.

But the in-built ‘View Detail’ dialog doesn’t let you drill into the EntityValidationErrors property.

To view the EntityValidationErrors collection, add the following Watch expression to the Watch window.

Which displays a similar to,

The watch expression ‘$exception’ displays any exception thrown in the current context, even if it has not been caught and assigned to a variable.