Wcf返回"成功"只是第一次和随后的电话返回"超时"

时间:2016-02-05 14:13:50

标签: wcf

我研究了这个问题,但我找不到任何有用的结果。 我尝试配置web.config和iis配置(禁用缓存等)但结果是否定的。 当我使用wcf作为restful请求时,一些wcf方法每次都可以正常工作,但是一些 wcf方法只是第一次返回成功,后续调用'结果返回"超时"。

当我重新启动iis并且,我在任务管理器上结束iis worker任务并调试wcf服务时,麻烦的方法第一次正常工作。

请帮帮我

提前谢谢

对于Ex:

[REQUEST] localhost / Service1.svc / GetData?value = 8

[RESPONSE]"您输入了:8"

GetData方法已经正常工作

但是对于Arm方法;

[首先请求] localhost / Service1.svc / Arm?pass = 1234& type = 2

[首先响应] {"数据":true,"错误":false,"消息":"成功"}

[REQUEST subsequents] localhost / Service1.svc / Arm?pass = 1234& type = 2

[响应子项] {"数据":false,"错误":true,"消息":"请求超时。请稍后重试"}

--- --- Service1.svc.cs

function buildMap(){
    var lbmp = document.getElementById("lbmp-map");
    if(lbmp != null){
        $.ajax({ 
            url:'../footer.htm',
            method: 'GET',
            success: function(response){
                lbmp.innerHTML = response.responseText;
            },
            failure: function(response){
                lbmp.innerHTML = "<p>Failure</p>";
            }
        }); 
    }
}

--- ---的Web.config

 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

    [ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.PerCall)]

    public class Service1 : IService1
    {
        [WebInvoke(Method = "GET",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        UriTemplate = "GetData?value={value}")]
        //stable method
        public string GetData(int value)
        {

            return string.Format("You entered: {0}", value);
        }

        [WebInvoke(Method = "GET",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        UriTemplate = "Arm?pass={pass}&type={type}")]
        //troubled method
        public ReturnType<bool> Arm(string pass, int type)
        {
            ParadoxFunctions pf = new ParadoxFunctions(pass);
            ReturnType<bool> ret = new ReturnType<bool>();

            ParadoxReturn pr = pf.ArmPanel(type);

            if (pr.Success)
            {
                ret.Error = false;
                ret.Message = pr.Message;
                ret.Data = true;
            }
            else
            {
                ret.Message = pr.Message;
            }

            return ret;
        }
     }

0 个答案:

没有答案