gpt4 book ai didi

WebAPI2 中的 Azure AD 图形请求

转载 作者:行者123 更新时间:2023-12-03 00:27:17 30 4
gpt4 key购买 nike

最近创建了 WebAPI2 Web 服务来获取所有 Active Directory 应用程序和用户的列表。将使用 Azure AD Graph API 毫无问题地获取本地 IIS 上的应用程序和用户列表。

在 Azure 上将 webAPI2 作为资源部署时。用户列表将按预期获取,但使用以下代码获取的应用程序列表会引发错误。

调用以获取应用程序列表:

IPagedCollection<IApplication> applications= await activeDirectoryClient.Applications.ExecuteAsync(); 

错误堆栈

System.ArgumentNullException: Value cannot be null. Parameter name: type at Microsoft.Data.Edm.EdmUtil.CheckArgumentNull[T](T value, String parameterName) at Microsoft.Data.Edm.EdmTypeSemantics.AsComplex(IEdmTypeReference type) at Microsoft.Data.OData.JsonLight.ODataJsonLightPropertyAndValueDeserializer.ReadNonEntityValueImplementation(String payloadTypeName, IEdmTypeReference expectedTypeReference, DuplicatePropertyNamesChecker duplicatePropertyNamesChecker, CollectionWithoutExpectedTypeValidator collectionValidator, Boolean validateNullValue, Boolean isTopLevelPropertyValue, Boolean insideComplexValue, String propertyName, Boolean readRawValueEvenIfNoTypeFound) at Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.ReadOpenProperty(IODataJsonLightReaderEntryState entryState, String propertyName, Boolean propertyWithValue) at Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.ReadUndeclaredProperty(IODataJsonLightReaderEntryState entryState, String propertyName, Boolean propertyWithValue) at Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.ReadEntryPropertyWithValue(IODataJsonLightReaderEntryState entryState, String propertyName)

申请流程:

My Web Application Let say A call WebAPI B to get list of Users and Applications. Application type of webAPI is native and i'm using UserPasswordCredential and AcquireTokenAsync to get access token.

最佳答案

在发布与 Azure 无关的内容时,我有时会遇到同样的问题 (Microsoft.Data.Edm.EdmUtil.CheckArgumentNull[...)。我想这是一个编译问题(有时有效,有时无效:-))...清理并发布即可完成工作(不幸的是)

关于WebAPI2 中的 Azure AD 图形请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54667025/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com