开发者

How to get result in javascript from a WCF method returns int?

I have one method in my wcf Service class that returns int and I am calling this method through javascript as below:

//Interface for Service

[Service开发者_如何学编程Contract(Namespace = "TestService")]
public interface ITestService
{
    [OperationContract]
    int GetTest(int A,int B);
}

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class TestService : ITestService
{
   public int GetTest(a,b)
   {
     return a + b;
   }
}

Calling the service in javascript goes like this:

TestService.ITestService.GetTest(a,b,returnId);

//method to get result id in javascript
function returnId(result)
{
   alert('Result :' + result);
}

Now here in alert everytime I am getting this result as null, why? Even I changed that int to List<int> and tried but getting the result as null.

and this is working fine on FireFox and other browser but not working on IE. Even use fiddler to find issue and in fiddler it is giving Content-Length mismatch error. but getting the Service method value in fiddler. Can anyone please help me why the result is null everytime with IE?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜