尝试连接到azure数据库突然停止工作,并引发异常 [英] Attempting to connect to azure database has suddenly stopped working, throwing exceptions
问题描述
我在Azure函数(V2)中运行以下代码;
I have the following code running in an Azure Function (V2);
new DocumentClient(new Uri(keys.dbEndPoint), keys.dbPrimaryKey);
直到今天,在localhost上的azure函数中运行良好的情况都没有改变,我现在得到以下异常:
Which has worked fine running in azure functions on localhost until today, without changing anything I'm now getting the following exception:
数据[IDictionary]:{System.Collections.ListDictionaryInternal} HResult [int]:-2146233036 HelpLink [string]:null InnerException [Exception]:{System.NullReferenceException:未设置对象引用 到对象的实例.}消息[string]:类型初始值设定项 为"Microsoft.Azure.Documents.UserAgentContainer"投掷了一个 异常."源[string]:"Microsoft.Azure.DocumentDB.Core" StackTrace [string]:"at Microsoft.Azure.Documents.UserAgentContainer..ctor()\ r \ n位于 Microsoft.Azure.Documents.Client.ConnectionPolicy..ctor()\ r \ n在 Microsoft.Azure.Documents.Client.ConnectionPolicy.get_Default()\ r \ n
在Microsoft.Azure.Documents.Client.DocumentClient.Initialize(Uri serviceEndpoint,ConnectionPolicy connectionPolicy,Nullable1 desiredConsistencyLevel)\r\n at Microsoft.Azure.Documents.Client.DocumentClient..ctor(Uri serviceEndpoint, String authKeyOrResourceToken, ConnectionPolicy connectionPolicy, Nullable
1 requiredConsistencyLevel)\ r \ n在 Platform.AzureConfig.get_Database()在 D:\ DeansCloud \ AzureConfig.cs:第60行"TargetSite [MethodBase]:{无效 .ctor()} TypeName [string]:"Microsoft.Azure.Documents.UserAgentContainer"静态成员 非公众成员
Data [IDictionary]:{System.Collections.ListDictionaryInternal} HResult [int]:-2146233036 HelpLink [string]:null InnerException [Exception]:{System.NullReferenceException: Object reference not set to an instance of an object.} Message [string]:"The type initializer for 'Microsoft.Azure.Documents.UserAgentContainer' threw an exception." Source [string]:"Microsoft.Azure.DocumentDB.Core" StackTrace [string]:" at Microsoft.Azure.Documents.UserAgentContainer..ctor()\r\n at Microsoft.Azure.Documents.Client.ConnectionPolicy..ctor()\r\n at Microsoft.Azure.Documents.Client.ConnectionPolicy.get_Default()\r\n
at Microsoft.Azure.Documents.Client.DocumentClient.Initialize(Uri serviceEndpoint, ConnectionPolicy connectionPolicy, Nullable1 desiredConsistencyLevel)\r\n at Microsoft.Azure.Documents.Client.DocumentClient..ctor(Uri serviceEndpoint, String authKeyOrResourceToken, ConnectionPolicy connectionPolicy, Nullable
1 desiredConsistencyLevel)\r\n at Platform.AzureConfig.get_Database() in D:\DeansCloud\AzureConfig.cs:line 60" TargetSite [MethodBase]:{Void .ctor()} TypeName [string]:"Microsoft.Azure.Documents.UserAgentContainer" Static members Non-Public members
不多说,内部异常提到了一个空引用异常:
Which doesn't say much, the inner exception mentions a null reference exception:
消息[string]:对象引用未设置为对象的实例."
Message [string]:"Object reference not set to an instance of an object."
天青宇宙数据库现在有问题吗?我需要更新一些东西吗?
Is this an issue with azure cosmos db now? Do I need to update something?
推荐答案
我发现此问题是最新的azure核心工具,降级为版本24进行了修复.
I found the issue to be the latest azure core tools, downgrading to version 24 fixed it.
这篇关于尝试连接到azure数据库突然停止工作,并引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!