Случайный метод NotFoundExepection в ComosDB? Есть идеи, что я делаю не так? - PullRequest
0 голосов
/ 03 ноября 2018

в течение последних нескольких дней я видел это сообщение об ошибке - при попытке получить доступ к моей идентичности ASP.net, размещенной в CosmosDB - этот код действительно не изменился в течение года, я не знаю, почему вдруг он начал рыгать.

Вот код в моем классе запуска, который инициализирует соединение с DocumentDB и ASP.net Identity (я использую полную платформу 4.6.1 (обновление до ядра к концу года) - клиент document.db 1.7.1 (который работал несколько дней назад - как чемпион)

        services.AddSingleton<IDocumentClient>(InitializeDocumentClient(
         new Uri("https://recipesavants.documents.azure.com:443/"),
         "REDACTED"));
        // Add framework services.
        services.AddIdentity<DocumentDbIdentityUser, DocumentDbIdentityRole>()
            .AddDocumentDbStores(options =>
            {
                options.Database = "recipes";
                options.UserStoreDocumentCollection = "users";
            }).AddDefaultTokenProviders();

    private DocumentClient InitializeDocumentClient(Uri endpointUri, string authorizationKey)
    {
        // Create a DocumentClient and an initial collection (if it does not exist yet) for sample purposes
        DocumentClient client = new DocumentClient(endpointUri, authorizationKey, new ConnectionPolicy { EnableEndpointDiscovery = false });

        try
        {
            var db = client.ReadDatabaseAsync(UriFactory.CreateDatabaseUri("recipes")).Result;
        }
        catch (AggregateException ae)
        {
            throw ae;
        }

        try
        {
            // Does the Collection exist?
            var collection = client.ReadDocumentCollectionAsync(UriFactory.CreateDocumentCollectionUri("recipes", "users")).Result;
        }
        catch (AggregateException ae)
        {
            throw ae;
        }
        return client;
    }

и вот трассировка стека - это очень случайно - и если я убью браузер, он снова заработает

System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1> Microsoft.Azure.Documents.IDocumentClient.ReadDocumentAsync(System.Uri, Microsoft.Azure.Documents.Client.RequestOptions)'.
   at RecipeSavants.Identity.DocumentDb.Tools.DocumentDbExtensions.d__1`1.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at RecipeSavants.Identity.DocumentDb.Tools.DocumentDbExtensions.ReadDocumentAsync[T](IDocumentClient client, Uri documentUri, RequestOptions requestOptions)
   at RecipeSavants.Identity.DocumentDb.Tools.DocumentDbExtensions.d__0`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at RecipeSavants.Identity.DocumentDb.Stores.DocumentDbUserStore`2.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Identity.SignInManager`1.d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Identity.SecurityStampValidator`1.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler.d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.d__48.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Authentication.AuthenticationService.d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Elmah.Io.AspNetCore.ElmahIoMiddleware.d__5.MoveNext()
...