WCF服务需要太多时间来响应 [英] WCF Service take too much time to response
本文介绍了WCF服务需要太多时间来响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我在Jquery中调用WCF函数。
服务需要几分之一的时间来返回问题列表。
但需要6-7秒才能获得成功功能。如何减少这段时间?
PLZ帮助。
Jquery电话
Hi I am calling WCF function in Jquery.
service take fraction of second to return list of questions.
but it take 6-7 second to come in success function. How to reduce this time?
plz help.
Jquery call
jQuery.support.cors = true;
return $.ajax({
type: _Type,
data: _Data,
contentType: _ContentType,
dataType: _DataType,
processdata: _ProcessData,
crossDomain: true,
async: false,
url: MyUrl,
success: function(msg) {
<big> ServiceGetQuestion(msg);</big>
},
error: ServiceFailed
});
在Wcf服务中。
In Wcf Service.
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
List<Question> GetAllQuestion();
推荐答案
.ajax({
类型:_Type,
数据:_Data,
contentType:_ContentType,
dataType:_DataType,
processdata:_ProcessData,
crossDomain: true ,
async: false ,
url:MyUrl,
成功: function (msg){
< big> ServiceGetQuestion(msg); < / big >
},
错误:ServiceFailed
});
.ajax({ type: _Type, data: _Data, contentType: _ContentType, dataType: _DataType, processdata: _ProcessData, crossDomain: true, async: false, url: MyUrl, success: function(msg) { <big> ServiceGetQuestion(msg);</big> }, error: ServiceFailed });
在Wcf服务中。
In Wcf Service.
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
List<Question> GetAllQuestion();
一些加快速度的策略:
使用压缩iis在Web服务器上。然而,基本上将开销转移到服务器上。
对服务中的Web方法本身进行大O分析。如果您发布此代码,我们可以提供帮助。
Some strategies to speed things up:
Use compression in iis on the web server. Basically moves the overhead to the server, however.
Big O analysis on the web method itself in the service. If you post this code maybe we can assist.
这篇关于WCF服务需要太多时间来响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文