I have the problem that my self hosted web api transfers large binary datas very slow. It takes 10 seconds to transfer an 10MB file. That is how i host the service:
var config = new HttpSelfHostConfiguration(url);
config.MaxReceivedMessageSize = long.MaxValue;
config.MaxBufferSize = int.MaxValue;
config.ReceiveTimeout = new TimeSpan(1, 0, 0);
config.TransferMode = TransferMode.Streamed;
config.Routes.MapHttpRoute(
"API Default", "api/{controller}/{id}",
new { id = RouteParameter.Optional });
HttpSelfHostServer server = new HttpSelfHostServer(config);
server.OpenAsync().Wait();
that is how i send the request:
Stopwatch time = new Stopwatch(); time.Start();
var blobObj = new BlobObject() { Blob = bt, Id = ui }; response =
await client.PostAsJsonAsync("api/archive", blobObj);
Console.WriteLine("ElapsedMilliseconds: " +
time.ElapsedMilliseconds.ToString());
Does anyone has an idea, what i am doing wrong?
System specification:
8GB Ram (2,7GB Free) 256GB SSD Intel i5 1st Generation 2.4GHz Windows 8.1 x64