В xamarin я вызываю api, используя библиотеку refit. Я следовал инструкциям , но при вызове исключения был возвращен API. Я не знаю, повлияет ли моя комбинация призмы? Я назвал ручной API, но он также не работает, я также консультировался по inte rnet, но кажется, что все еще не работает. В расширенном варианте Android я устанавливаю реализацию HttpClient на Android, реализация SSL / TSL - по умолчанию (собственный TLS 1.2+). Могу ли я помочь мне?
public interface IMakeUpApi
{
[Get("/api/v2/items")]
Task<string> GetMakeups();
}
В MainPageViewModel
var apiResponse = RestService.For<IMakeUpApi>("https://qiita.com");
var makeups = await apiResponse.GetMakeups();
Ошибка
Система. Net .HttpRequestException Message = mono-io- layer-error (-1) Source = mscorlib StackTrace: at System. Net .Http.ConnectHelper.ConnectAsyn c (хост System.String, порт System.Int32, System.Threading.CancellationToken cancellationToken) [0x00180] в / Пользователи / строитель / jenkins / workspace / archive-mono / 2019-08 / android / release / external / corefx / src / System. Net .Http / src / System / Net / Http / SocketsHttpHandler / ConnectHelper.cs: 84 at System.Threading.Tasks.ValueTask 1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x000ea] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:371
at System.Threading.Tasks.ValueTask
1 [TResult] .get_Result () [0x0001b] в / Users / builder / jenkins / workspace / archive-mono / 2019-08 / android / release / external / corefx / src / Common /src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 в System. Net .Http.HttpConnectionPool.WaitForCreatedConnectionAsyn c (System.Threading.Tasks.ValueTask 1[TResult] creationTask) [0x000a2] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:529
at System.Threading.Tasks.ValueTask
1_Rult). [0x0001b] в / Users / builder / jenkins / workspace / archive-mono / 2019-08 / android / release / external / corefx / src / Common / src / CoreLib / System / Threading / Tasks / ValueTask.cs: 813 в System. Net .Http.HttpConnectionPool.SendWithRetryAsyn c (System. Net .Http.HttpRequestMessage, запрос System.Boolean, doReestAuthuth .Threading.CancellationToken cancellationToken) [0x0003f] в /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net /Http/SocketsHttpHandler/HttpConnectionPool.cs:284 в System. Net .Http.RedirectHandler.SendAsyn c (System. Net .Http.HttpRequestMessage, запрос System.Threading.CancellationToken в 0 0] в отмене /builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RedirectHandler.cs:32 в системе . Net .Http.HttpClient.FinishSendAsyncUnbuffered (System.Threading.Tasks.Task 1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x000b3] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClient.cs:531
at Refit.RequestBuilderImplementation+<>c__DisplayClass14_0
2 [T, TBody] .b__0 (System. Net .Http.HttpClient клиент, System.Threading.CancellationToken ct. System. Object [] paramList) [0x00 188] в: 0 в TestApp.ViewModels.MainPageViewModel.Navigate () [0x0003b] в E: \ H \ Xamarin \ TestApp \ TestApp \ TestApp \ ViewModels \ MainPageViewModel.cs: 58 в System.Runtime.CompilerServices.AsBilter 1121 * .b__7_0 (состояние System.Object) [0x00000] в / Users / builder / jenkins / workspace / archive-mono / 2019-08 / android / release / mcs / class / referenceource / mscorlib / system / runtime / compilerservices / AsyncMethodBuilder .cs: 1021 в Android .App.SyncContext + <> c__DisplayClass2_0.b__0 () [0x00000] в: 0 в Java .Lang.Thread + RunnableImplementor.Run () [0x00008] в: 0 в Java. Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] в: 0 at (оберточный динамический c -метод) Android .Runtime.DynamicMethodNameCounter.39 * (intptr, intptr)
Сведения об исключении
- ex {System. Net .Http.HttpRequestException: ошибка моно-слоя (-1) ---> System. Net .Sockets.SocketException: ошибка моно-слоя (-1) в системе. Net .Http.ConnectHelper.ConnectAsy n c (хост System.String, порт System.Int32, System.Threading.CancellationToken cancellationToken) [0x000c8] в / Users / builder / jenkins / workspace / archive-mono / 2019-08 / android / release / external / corefx /src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectHelper.cs:65 --- Конец внутренней трассировки стека исключений --- в System. Net .Http.ConnectHelper.ConnectAsyn c (хост System.String, система. Порт Int32, System.Threading.CancellationToken cancellationToken) [0x00180] в /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src /System/Net/Http/SocketsHttpHandler/ConnectHelper.cs:84 в System.Threading.Tasks.ValueTask
1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x000ea] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:371
at System.Threading.Tasks.ValueTask
1 [TResult] .get_Result () [0x0001b] в / Users / builder / jenkins / workspace / archive-mono / 2019-08 / android / release / external / corefx / src / Common / src / CoreLib / System / Threading / Tasks / ValueTask.cs: 813 в System. Net .Http.HttpConnectionPool.WaitForCreatedConnectionAsyn c (System.Threading .Tasks.ValueTask 1[TResult] creationTask) [0x000a2] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:529
at System.Threading.Tasks.ValueTask
1 [TResult] .get_Result () [0x0001b] в / Users / builder / jenkins / workspace / archive-mono / 2019-08 / android / release / external / corefx / src / Common / src / CoreLib / System / Threading / Tasks / ValueTask.cs: 813 в System. Net .Http.HttpConnectionPool.SendWithRetryAsyn c (System. Net .Http.HttpRequestMessage, запрос System.Boolean doRequestAuth, System.ThreadingTextCread cancellationToken) [0x0003f] в / Users / buildde r / jenkins / workspace / archive-mono / 2019-08 / android / release / external / corefx / src / System. Net .Http / src / System / Net / Http / SocketsHttpHandler / HttpConnectionPool.cs: 284 в разделе Система. Net .Http.RedirectHandler.SendAsyn c (System. Net .Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00070] в / Users / builder / jenkins / workspace / archive-mono / 2019- 08 / android / release / external / corefx / src / System. Net .Http / src / System / Net / Http / SocketsHttpHandler / RedirectHandler.cs: 32 в системе. Net .Http.HttpClient.FinishSendAsyncUnbuffered (система. Threading.Tasks.Task 1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x000b3] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClient.cs:531
at Refit.RequestBuilderImplementation+<>c__DisplayClass14_0
2 [T, TBody] .b__0 (System. Net .Http.HttpClient клиент, System.Threading.CancellationToken ct, System.Object [] paramList) [0x00188] в: 0 в TestApp .ViewModels.MainPageViewModel.Navigate () [0x00044] в E: \ H \ Xamarin \ TestApp \ TestApp \ TestApp \ ViewModels \ MainPageViewModel.cs: 60} Система. Net .Http.HttpRequestException - base { System.Exception} System.Exception
- Data {System.Collections.Li stDictionaryInternal} System.Collections.ListDictionaryInternal HResult -2147467259 int HelpLink (null) string
- InnerException {System. Net .Sockets.SocketException} System. Net .Sockets.SocketException
- base {System.ComponentModel.Win32Exception} System.ComponentModel.Win32Exception
- base {System.Runtime.InteropServices.ExternalException} System.Runtime.InteropServices.ExternalException
- base {System.SystemException} System.SystemException}
- base {System.Exception} System.Exception
- Data {System.Collections.ListDictionaryInternal} System.Collections.ListDictionaryInternal HResult -2147467259 int HelpLink (null) string InnerException (null) System.Exception Сообщение "mono-io-layer-error (-1)" string Источник "mscorlib" string StackTrace "в System. Net .Http.ConnectHelper.ConnectAsyn c (хост System.String, порт System.Int32, система. Threa… "string
- TargetSite {System.Reflection.RuntimeMethodInfo} System.R eflection.RuntimeMethodInfo
- base {System.Reflection.MethodInfo} System.Reflection.MethodInfo Атрибуты System.Reflection.MethodAttributes.FamANDAssem | System.Reflection.MethodAttributes.Family | System.Reflection.MethodAttributes.HideBySig System.Reflection.MethodAttributes CallingConvention System.Reflection.CallingConventions.HasThis | System.Reflection.CallingConventions.Standard System.Reflection.CallingConventions ContainsGenericParameters ложь BOOL
- MethodHandle {System.RuntimeMethodHandle} System.RuntimeMethodHandle
- Модуль {System.Reflection.RuntimeModule} System.Reflection.RuntimeModule Имя «Throw» string
- ReflectedType {System.RuntimeTpe. RuntimeType
- ReturnParameter {System.Reflection.RuntimeParameterInfo} System.Reflection.RuntimeParameterInfo
- ReturnType {System.RuntimeType} System.RuntimeType
- ReturnTypeCustomAttribuIn {. .Reflection. System.IntPtr name "Throw" string
- reftype {System.RuntimeType} System.RuntimeType
- Stati c member
- Non-publi * c members
ErrorCode -1 int NativeErrorCode -1 int - Не опубликовано c м embers
ErrorCode -1 int Сообщение «mono-io-layer-error (-1)» string Система SocketErrorCode. Net .Sockets.SocketError.SocketError System. Net .Sockets.SocketError - Непубликуемые c члены
Сообщение "mono-io-layer-error (-1)" string Источник "mscorlib" string StackTrace "в System. Net .Http.ConnectHelper.ConnectAsyn c (Система. Строковый хост, порт System.Int32, System.Threa… "string - TargetSite {System.Reflection.RuntimeMethodInfo} System.Reflection.RuntimeMethodInfo
- Stati c members
- Непубликуемые c члены
_COMPlusExceptionCode -532462766 int - s_EDILock {object} object
- Непубликуемые c члены
IsTransient System.NotImplementedException: метод или операция не реализовано. bool RemoteStackTrace (null) строка _HResult -2147467259 int _className "System. Net .Http.HttpRequestException" string - _data {System.Collections.ListDictionaryInternal} System.Collections.ListDictionaryInternal _llllLoull (nullMurll) nullMullHD ) string
- _innerException {System. Net .Sockets.SocketException} System. Net .Sockets.SocketException _message "mono-io-layer-error (-1)" string _remoteStackIndex 0 int _remoteStackTraceString (null ) string
- _safeSerializationManager {System.Runtime.Serialization.SafeSerializationManager} System.Runtime.Serialization.SafeSerializationManager _source "mscorlib" string
- _stackTrace {System.IntPtr [18]}. _stackTraceString (null) string
- captured_traces {System.Diagnostics.StackTrace [7]} System.Diagnostics.StackTrace [] catch_in_unmanaged 0 int native_trace_ips (null) System.IntPtr []
* 1101