xamarin.ios - Connection faliure issue when i hit the web API in Xamarin IOS -
some time facing issue of connect failure
when hit web api in xamarin ios project. api working fine , issue in connection. if 1 have idea solve issue or have link through can solve issue. please send me because have tried many solution couldn't solve it.
error log ::::::::::::::::
{system.aggregateexception: 1 or more errors occurred. ---> system.net.webexception: error: connectfailure (too many open files) ---> system.net.sockets.socketexception: many open files @ system.net.sockets.socket..ctor (addressfamily addressfamily, sockettype sockettype, protocoltype protocoltype) [0x00060] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/mcs/class/system/system.net.sockets/socket.cs:214 @ system.net.webconnection.connect (system.net.httpwebrequest request) [0x000f6] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/mcs/class/system/system.net/webconnection.cs:189 --- end of inner exception stack trace --- @ system.net.httpwebrequest.endgetresponse (iasyncresult asyncresult) [0x00065] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/mcs/class/system/system.net/httpwebrequest.cs:946 @ system.threading.tasks.taskfactory
1[tresult].fromasynccorelogic (iasyncresult iar, system.func
2 endfunction, system.action1 endaction, system.threading.tasks.task
1 promise, boolean requiressynchronization) <0x1002da730 + 0x0005b> in :0 --- end of stack trace previous location exception thrown --- @ system.runtime.exceptionservices.exceptiondispatchinfo.throw () [0x0000c] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess (system.threading.tasks.task task) [0x0003b] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/taskawaiter.cs:199 @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification (system.threading.tasks.task task) [0x0002e] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/taskawaiter.cs:170 @ system.runtime.compilerservices.taskawaiter.validateend (system.threading.tasks.task task) [0x0000b] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/taskawaiter.cs:142 @ system.runtime.compilerservices.configuredtaskawaitable1+configuredtaskawaiter[tresult].getresult () <0x10027a4f0 + 0x0001b> in <filename unknown>:0 @ system.net.http.httpclienthandler+<sendasync>c__async0.movenext () [0x003d6] in /library/frameworks/xamarin.ios.framework/versions/9.6.1.9/src/mono/mcs/class/system.net.http/system.net.http/httpclienthandler.cs:372 --- end of stack trace previous location exception thrown --- @ system.runtime.exceptionservices.exceptiondispatchinfo.throw () [0x0000c] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess (system.threading.tasks.task task) [0x0003b] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/taskawaiter.cs:199 @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification (system.threading.tasks.task task) [0x0002e] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/taskawaiter.cs:170 @ system.runtime.compilerservices.taskawaiter.validateend (system.threading.tasks.task task) [0x0000b] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/taskawaiter.cs:142 @ system.runtime.compilerservices.configuredtaskawaitable
1+configuredtaskawaiter[tresult].getresult () <0x10027a4f0 + 0x0001b> in :0 @ system.net.http.httpclient+c__async0.movenext () [0x000a9] in /library/frameworks/xamarin.ios.framework/versions/9.6.1.9/src/mono/mcs/class/system.net.http/system.net.http/httpclient.cs:274 --- end of inner exception stack trace --- @ system.threading.tasks.task.throwifexceptional (boolean includetaskcanceledexceptions) [0x00014] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/threading/tasks/task.cs:2168 @ system.threading.tasks.task1[tresult].getresultcore (boolean waitcompletionnotification) <0x1002d9dc0 + 0x0006f> in <filename unknown>:0 @ system.threading.tasks.task
1[tresult].get_result () <0x1002d9d50 + 0x0002b> in :0 @ rsystemapp.controller.holidaycontroller.getleaveinformation (int64 employeeid) [0x00025] in d:\mukesh\tfscode\rsimobileapp\rsystemapp\rsystemapp\controller\holidaycontroller.cs:83 ---> (inner exception #0) system.net.webexception: error: connectfailure (too many open files) ---> system.net.sockets.socketexception: many open files @ system.net.sockets.socket..ctor (addressfamily addressfamily, sockettype sockettype, protocoltype protocoltype) [0x00060] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/mcs/class/system/system.net.sockets/socket.cs:214 @ system.net.webconnection.connect (system.net.httpwebrequest request) [0x000f6] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/mcs/class/system/system.net/webconnection.cs:189 --- end of inner exception stack trace --- @ system.net.httpwebrequest.endgetresponse (iasyncresult asyncresult) [0x00065] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/mcs/class/system/system.net/httpwebrequest.cs:946 @ system.threading.tasks.taskfactory1[tresult].fromasynccorelogic (iasyncresult iar, system.func
2 endfunction, system.action1 endaction, system.threading.tasks.task
1 promise, boolean requiressynchronization) <0x1002da730 + 0x0005b> in :0 --- end of stack trace previous location exception thrown --- @ system.runtime.exceptionservices.exceptiondispatchinfo.throw () [0x0000c] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess (system.threading.tasks.task task) [0x0003b] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/taskawaiter.cs:199 @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification (system.threading.tasks.task task) [0x0002e] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/taskawaiter.cs:170 @ system.runtime.compilerservices.taskawaiter.validateend (system.threading.tasks.task task) [0x0000b] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/taskawaiter.cs:142 @ system.runtime.compilerservices.configuredtaskawaitable1+configuredtaskawaiter[tresult].getresult () <0x10027a4f0 + 0x0001b> in <filename unknown>:0 @ system.net.http.httpclienthandler+<sendasync>c__async0.movenext () [0x003d6] in /library/frameworks/xamarin.ios.framework/versions/9.6.1.9/src/mono/mcs/class/system.net.http/system.net.http/httpclienthandler.cs:372 --- end of stack trace previous location exception thrown --- @ system.runtime.exceptionservices.exceptiondispatchinfo.throw () [0x0000c] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess (system.threading.tasks.task task) [0x0003b] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/taskawaiter.cs:199 @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification (system.threading.tasks.task task) [0x0002e] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/taskawaiter.cs:170 @ system.runtime.compilerservices.taskawaiter.validateend (system.threading.tasks.task task) [0x0000b] in /users/builder/data/lanes/3051/5f11db87/source/maccore/_build/library/frameworks/xamarin.ios.framework/versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/taskawaiter.cs:142 @ system.runtime.compilerservices.configuredtaskawaitable
1+configuredtaskawaiter[tresult].getresult () <0x10027a4f0 + 0x0001b> in :0 @ system.net.http.httpclient+c__async0.movenext () [0x000a9] in /library/frameworks/xamarin.ios.framework/versions/9.6.1.9/src/mono/mcs/class/system.net.http/system.net.http/httpclient.cs:274 <--- }
how call web api?
i have problem before.
my code:
httpclient client = new httpclient (); ... httpresponsemessage response = await client.postasync (“webapi url” , postcontent);
solution:
using(httpclient client = new httpclient ()) { ... httpresponsemessage response = await client.postasync("webapi url" , postcontent); ... }
it seems don't dispose httpclient
you can see page: https://dotblogs.com.tw/rainmaker/2016/06/06/103035
hope can fix it
Comments
Post a Comment