Asp.net WCF只能异步工作
我的Web应用程序中有一个WCF“MWManageSession”服务,因此我没有任何服务引用。 问题在于,它似乎只能异步工作,而不是同步工作 公共接口IMWManageSession{Asp.net WCF只能异步工作,asp.net,.net,wcf,client,asp.net-ajax,Asp.net,.net,Wcf,Client,Asp.net Ajax,我的Web应用程序中有一个WCF“MWManageSession”服务,因此我没有任何服务引用。 问题在于,它似乎只能异步工作,而不是同步工作 公共接口IMWManageSession{ [OperationContract] [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)] string SetIdSelezio
[OperationContract]
[WebInvoke(Method = "POST",
BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json)]
string SetIdSelezionato_SessionData(String[] pvalori, SessionNavigation pSN, long varpChangingAzienda);
}
我使用
$.ajax({
type: "POST",
url: webMethod,
data: jsonText,
processData: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
ServiceSucceeded(msg, ptoPopup, DatixWCF, myvar);
},
error: ServiceFailed
});
function ServiceSucceeded(result, ptoPopup, DatixWCF, myvar) {
console.log("ServiceSucceeded: " + result);
}
当wcf进行钢铁加工时,我得到了我放在“OnServiceSucceed”上的执行代码
如何使wcf仅同步工作?
提前谢谢 也许您可以尝试添加到ajax帖子
async:false
大概是这样的:
$.ajax({
type: "POST",
url: webMethod,
data: jsonText,
processData: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
success: function (msg) {
ServiceSucceeded(msg, ptoPopup, DatixWCF, myvar);
},
error: ServiceFailed
});
它不是WCF,它的ajax在这里是异步的,这里引用Async=false,我相信你说的是Async:false。Uppsss!!小错误不!,我是说同步。。我需要wcf同步工作。。。(虽然它必须工作,但同步异步!!!如果我添加“async:false,”-->我遇到了这个错误:主线程上的请求同步XMLHttpRequest由于对用户体验的负面影响而被弃用。进一步的信息@S.A.当然,您会得到警告,因为由于用户体验等原因,不建议使用同步调用。如果必须“真的”同步调用,不要介意那个警告。