我有一个 WCF Rest 服务,我用 Fiddler 进行了测试,因为我在 Android 移动设备上遇到了缓慢的性能。我不是服务器端的专家,但我看到服务器在写回响应之前有延迟。我复制了 Fiddler 结果。可能是什么问题呢?
== TIMING INFO ============
ClientConnected: 09:26:06.907
ClientBeginRequest: 09:26:06.907
GotRequestHeaders: 09:26:06.907
ClientDoneRequest: 09:26:06.907
Determine Gateway: 0ms
DNS Lookup: 0ms
TCP/IP Connect: 1222ms
HTTPS Handshake: 0ms
ServerConnected: 09:26:08.130
FiddlerBeginRequest: 09:26:08.130
ServerGotRequest: 09:26:08.131
ServerBeginResponse: 09:26:44.151
GotResponseHeaders: 09:26:44.151
ServerDoneResponse: 09:26:44.151
ClientBeginResponse: 09:26:44.151
ClientDoneResponse: 09:26:44.151
Overall Elapsed: 00:00:37.2441302
The response was buffered before delivery to the client.
服务托管为 WebServiceHost2。
服务方式:
[OperationContract]
[WebInvoke(UriTemplate = "Test/PostData", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Stream PostTestData(Stream data);
public Stream PostTestData(Stream data)
{
try
{
Thread.Sleep(1000);
}
catch (Exception ex)
{
ex.Log(ex.Message);
}
return null;
}