This file contains hidden or 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 static Func<IDictionary<string, object>, Task> CreateWebApiAppFunc(HttpConfiguration config) | |
{ | |
var app = new HttpServer(config); | |
var options = new HttpMessageHandlerOptions() | |
{ | |
MessageHandler = app, | |
BufferPolicySelector = new OwinBufferPolicySelector(), | |
ExceptionLogger = new WebApiExceptionLogger(), | |
ExceptionHandler = new WebApiExceptionHandler() | |
}; |
This file contains hidden or 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 NullJsonHandler : DelegatingHandler | |
{ | |
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | |
{ | |
var response = await base.SendAsync(request, cancellationToken); | |
if (response.Content == null) | |
{ | |
response.Content = new StringContent("{}"); |
This file contains hidden or 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 static class TaskHelper | |
{ | |
public static Task<T> RunWithCancel<T>(Func<CancellationToken,T> function, CancellationToken token) | |
{ | |
return Task.Run(() => function(token),token); | |
} | |
} |
This file contains hidden or 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
1) Remove all nuget packages with any relationship to the package having a problem | |
2) Ensure that no project still has a DLL reference to assemblies from those nuget packages | |
3) Remove all binding redirects related to these nuget packages | |
4) Add nuget packages, one at a time, in order of dependencies. (i.e. Don't let any nuget package automatically pull in another) | |
5) Add binding redirects for anything that still has a problem | |
6) Enjoy the build successful | |
This file contains hidden or 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 RunscopePassagewayHandler : DelegatingHandler { | |
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { | |
if (request.RequestUri.Host.Contains("passageway.io")) { | |
var uriWithoutPort = request.RequestUri.GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped); | |
request.RequestUri = new Uri(uriWithoutPort); | |
} | |
return base.SendAsync(request, cancellationToken); | |
} | |
} |
This file contains hidden or 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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
ServicePointManager.DefaultConnectionLimit = 2; | |
var tasks = new Task[10]; | |
for (int i = 0; i < 10; i++) | |
{ | |
tasks[i] = Run(); |
This file contains hidden or 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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var server = WebApp.Start("http://localhost:1002/", (app) => | |
{ | |
var config = new HttpConfiguration(); | |
config.MapHttpAttributeRoutes(); | |
config.Services.Replace(typeof(IExceptionHandler), new RethrowExceptionHandler()); |
This file contains hidden or 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.Net.Http; | |
using System.Net.Http.Headers; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Salesforce.Common.Models; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; | |
namespace Salesforce.Common |
This file contains hidden or 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
GET http://finance.services.appex.bing.com/Market.svc/AppTileV2?symbols=127.10.0000&contentType=0&tileType=0&locale=en-ca&symbolTypes= HTTP/1.1 | |
User-Agent: Microsoft-WNS/6.3 | |
Host: finance.services.appex.bing.com | |
Pragma: no-cache | |
=> | |
HTTP/1.1 200 OK | |
Content-Length: 1126 | |
Content-Type: application/xml; charset=utf-8 | |
Last-Modified: Fri, 10 Jan 2014 21:51:25 GMT |
This file contains hidden or 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
Server Software: Microsoft-HTTPAPI/2.0 | |
Server Hostname: OAK | |
Server Port: 1001 | |
Document Path: /CacheableResource | |
Document Length: 22 bytes | |
Concurrency Level: 1000 | |
Time taken for tests: 4.499 seconds | |
Complete requests: 60000 |