Wednesday, 6 November 2019

Re-install nuget packages

Here's how to reinstall nuget packages for your solution:
Update-Package -reinstall

Wednesday, 30 October 2019

Windows exe with optional console

Today I had to change the console app I'd already built into something more silent, but a console was still required in some circumstances.

All I had to do was switch the output type (Properties > Application) to 'Windows Application' and add the following code:

Friday, 7 June 2019

Configuring SignalR

Each host has access to an IConfigurationManager which allows you to tweak some default SignalR settings. Some things that can be tweaked are:

  •     ConnectionTimeout - Represents the amount of time to leave a connection open before timing out. Default is 110 seconds.
  •     DisconnectTimeout - Represents the amount of time to wait after a connection goes away before raising the disconnect event. Default is 30 seconds.
  •     KeepAlive - Representing the amount of time to wait before sending a keep alive packet over an idle connection. Set to null to disable keep alive. This is set to 30 seconds by default. When this is on, the ConnectionTimeout will have no effect.

Tuesday, 7 August 2018

Ignoring a property in Fixture

I've been using Fixture for unit testing, and today I needed to ignore a property in a model. This is how its done:

Tuesday, 26 June 2018

Querying an IIS Express site over the LAN

Open this file:

C:\Users[YourName]\Documents\IISExpress\config\applicationhost.config


Add this row to the bindings element

<binding bindinginformation="*:yyyy:xxx.xxx.xxx.xxx" protocol="http" />


where yyyy is your chosen port number and xxx.xxx.xxx.xxx is IP address on your network.


Run these two commands in a admin cmd prompt

netsh http add urlacl url=http://xxx.xxx.xxx.xxx:yyyyy/ user=everyone

netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=1914 profile=private remoteip=localsubnet action=allow