[英]WCF Timeout Issue in iOS
I am using C# for ios application that I have been developing. 我正在将C#用于正在开发的ios应用程序。 I have a problem with timeout.
我有超时问题。
I followed at the following link http://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/ 我跟随以下链接http://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/
So this is my client helper 这是我的客户帮手
public class ClientHelper
{
// DM Service Address
private static readonly EndpointAddress EndPoint = new EndpointAddress("https://xxxxxxx/aaaaa/bbbbb.svc/basic");
public static DMServiceClient CreateClient ()
{
var binding = CreateBasicHttp();
return new DMServiceClient(binding, EndPoint);
}
private static BasicHttpBinding CreateBasicHttp()
{
var binding = new BasicHttpBinding()
{
Name = "BSHttpBinding",
MaxReceivedMessageSize = 2147483647,
MaxBufferSize = 2147483647
};
binding.ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas()
{
MaxArrayLength = 2147483646,
MaxStringContentLength = 524288045
};
var timeout = new TimeSpan(0, 0, 2);
binding.SendTimeout = timeout;
binding.OpenTimeout = timeout;
binding.ReceiveTimeout = timeout;
binding.CloseTimeout = timeout;
binding.Security.Mode = BasicHttpSecurityMode.Transport;
return binding;
}
}
Process can take more than 10 seconds and i set timeout as 2 seconds but not occured any exception. 过程可能需要10秒钟以上,我将超时设置为2秒钟,但没有发生任何异常。
We tried in desktop app and set it in appconfig file, it works. 我们在桌面应用程序中尝试过,并将其设置在appconfig文件中,它可以工作。 in iOS app, there is not appconfig file then i give timeout manualy like that.
在iOS应用程序中,没有appconfig文件,然后我手动给出超时。
I found the answer.. Interesting, there is no information about it.. 我找到了答案..有趣的是,没有关于它的信息..
service.InnerChannel.OperationTimeout = TimeSpan.FromSeconds(30.0);
so it solved my problem.. https://stackoverflow.com/a/10108281/1022138 所以它解决了我的问题.. https://stackoverflow.com/a/10108281/1022138
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.