FirebaseException: Javax. Net .Ssl.SSLPeerUnverifiedException При попытке подключиться к Firebase из приложения Xamarin - PullRequest
0 голосов
/ 18 апреля 2020

Я создаю приложение Xamarin, которое подключается к базе данных в firebase. Он работал нормально, потом случайно перестал работать, и я не смог его в течение нескольких дней. Исключение, которое я получаю:

Firebase.Database.FirebaseException: Exception occured while processing the request.
Url: https://www.geos-d9135.firebaseio.com/Geo/.json
Request Data: 
Response:  ---> Javax.Net.Ssl.SSLPeerUnverifiedException: Hostname www.geos-d9135.firebaseio.com not verified:    
  certificate: sha1/I8e7gc6oYm9bwZba2fuQCuDGZKk=    
  DN: CN=firebaseio.com,O=Google LLC,L=Mountain View,ST=California,C=US    
  subjectAltNames: [firebaseio.com, *.firebaseio.com]  at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in <26521a5118b44c858c385715922b9d5d>:0   
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00014] in <26521a5118b44c858c385715922b9d5d>:0   
at Javax.Net.Ssl.HttpsURLConnectionInvoker.Connect () [0x0000a] in <4ccdb3137d974856b786e1aeebbfbab6>:0   
at Xamarin.Android.Net.AndroidClientHandler+<>c__DisplayClass44_0.<ConnectAsync>b__0 () [0x0005a] in <4ccdb3137d974856b786e1aeebbfbab6>:0   
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2476   
at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319 --- End of stack trace from previous location where exception was thrown ---  
at Xamarin.Android.Net.AndroidClientHandler.DoProcessRequest (System.Net.Http.HttpRequestMessage request, Java.Net.URL javaUrl, Java.Net.HttpURLConnection httpConnection, System.Threading.CancellationToken cancellationToken, Xamarin.Android.Net.AndroidClientHandler+RequestRedirectionState redirectState) [0x0012e] in <4ccdb3137d974856b786e1aeebbfbab6>:0   
at Xamarin.Android.Net.AndroidClientHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x002cf] in <4ccdb3137d974856b786e1aeebbfbab6>:0   
at System.Net.Http.HttpClient.FinishSendAsyncBuffered (System.Threading.Tasks.Task`1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x0017e] in /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClient.cs:506   
at Firebase.Database.Http.HttpClientExtensions.GetObjectCollectionAsync[T] (System.Net.Http.HttpClient client, System.String requestUri, Newtonsoft.Json.JsonSerializerSettings jsonSerializerSettings) [0x00098] in <2cf89c22afe1453abece5a4e4d8b1e59>:0    --- End of inner exception stack trace ---  at Firebase.Database.Http.HttpClientExtensions.GetObjectCollectionAsync[T] (System.Net.Http.HttpClient client, System.String requestUri, Newtonsoft.Json.JsonSerializerSettings jsonSerializerSettings) [0x001ab] in <2cf89c22afe1453abece5a4e4d8b1e59>:0   
at Firebase.Database.Query.FirebaseQuery.OnceAsync[T] (System.Nullable`1[T] timeout) [0x00129] in <2cf89c22afe1453abece5a4e4d8b1e59>:0   at Geos.FirebaseHelper.BusinessObjectProvider`1[T].GetAllItems () [0x00078] in C:\Users\krhodes\source\repos\Geos\Geos\FirebaseHelper\BusinessObjectProvider.cs:26   at Geos.GeosPage.OnAppearing () [0x00052] in C:\Users\krhodes\source\repos\Geos\Geos\Views\GeosPage.xaml.cs:29   
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021   
at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <4ccdb3137d974856b786e1aeebbfbab6>:0   
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <4ccdb3137d974856b786e1aeebbfbab6>:0   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <4ccdb3137d974856b786e1aeebbfbab6>:0   
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.46(intptr,intptr)

, и оно исходит из этого кода:

protected readonly FirebaseClient firebase = new FirebaseClient("https://www.geos-d9135.firebaseio.com/");

        protected string ChildName = typeof(T).Name;

        public async Task<List<BusinessObject>> GetAllItems()
        {
            List<BusinessObject> result;

            BusinessObjectCache<T> businessObjectCache = BusinessObjectCache<T>.GetInstance();
            if (businessObjectCache.cache == null || businessObjectCache.cache.Count == 0)
            {
                result = (await firebase
                    .Child(ChildName)
                    .OnceAsync<T>()).Select(item => BusinessObject.CloneFromItem(item.Object)).ToList();
                businessObjectCache.cache = result.Select(item => (T)item).ToList();
            } else
            {
                result = businessObjectCache.cache.Select(item => (BusinessObject)item).ToList();
            }
            return result;
        }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...