This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: Specify project file | |
IF "%PROJECT%" == "" ( | |
SET PROJECT=PROJECTFILEGOESHERE | |
) | |
IF "%PROJECT%" == "PROJECTFILEGOESHERE" goto MissingProject | |
:: Specify project configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Clients.addMessage(message); | |
Others.addMessage(message); // Does not exist yet | |
Clients[group].addMessage(message); | |
Clients[Context.ConnectionId].addMessage(message); | |
IClientProxy proxy = Clients; | |
proxy.Invoke("addMessage", message); | |
IClientProxy proxy1 = Clients[group]; | |
proxy1.Invoke("addMessage", message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 | |
{ | |
class Program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Net.Http; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Newtonsoft.Json; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static int GetRoleInstanceNumber() | |
{ | |
var roleInstanceId = RoleEnvironment.CurrentRoleInstance.Id; | |
var li1 = roleInstanceId.LastIndexOf("."); | |
var li2 = roleInstanceId.LastIndexOf("_"); | |
var roleInstanceNo = roleInstanceId.Substring(Math.Max(li1, li2) + 1); | |
return Int32.Parse(roleInstanceNo); | |
} | |
string connectionString = // Your connection string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class ShutdownDetector : IRegisteredObject, IDisposable | |
{ | |
private readonly CancellationTokenSource _cts = new CancellationTokenSource(); | |
private Timer _checkAppPoolTimer; | |
private static readonly TimeSpan _appPoolCheckInterval = TimeSpan.FromSeconds(10); | |
public CancellationToken Token | |
{ | |
get { return _cts.Token; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Chat : Hub | |
{ | |
public void Send(string message) | |
{ | |
// Call send on everyone | |
Clients.All.send(message); | |
// Call send on everyone except the caller | |
Clients.Others.send(message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static IEnumerable<Task> DoItAsync() | |
{ | |
yield return Task.Delay(1000); | |
yield return Task.Run(() => 1 + 1); | |
Console.WriteLine("hello"); | |
} | |
public static Task AsyncEnumerator(Func<IEnumerable<Task>> taskChainFactory) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication10 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5000 connections: | |
73d237c4 5000 60000 System.Threading.CancellationToken | |
05ae8b40 5000 60000 Microsoft.AspNet.SignalR.TaskAsyncHelper+<>c__DisplayClass5`1[[System.Threading.Tasks.Task, mscorlib]] | |
05a522cc 5000 60000 Microsoft.AspNet.SignalR.Infrastructure.SafeSet`1[[System.String, mscorlib]] | |
05a51624 5000 60000 Microsoft.AspNet.SignalR.Connection+<>c__DisplayClass2 | |
01434310 5000 60000 System.Threading.Tasks.TaskCompletionSource`1[[Microsoft.AspNet.SignalR.Client.Http.IResponse, Microsoft.AspNet.SignalR.Client]] | |
05ae8dd8 5429 65148 Microsoft.AspNet.SignalR.TaskAsyncHelper+<>c__DisplayClass9`1[[System.Threading.Tasks.Task, mscorlib]] | |
05aecf48 5000 80000 Microsoft.AspNet.SignalR.TaskAsyncHelper+<>c__DisplayClass1c | |
05aece24 5000 80000 Microsoft.AspNet.SignalR.Infrastructure.CancellationTokenExtensions+<>c__DisplayClass4`1[[System.IDisposable, mscorlib]] |