asp.net - Odata 提要未在 PowerBI 或 Excel 中连接
问题描述
我在 asp.net web api 应用程序中有一个 OData 提要设置。该应用程序使用 Azure AD 进行身份验证,因此我计划在 PowerBI 脚本中传递不记名令牌,如下所述:
通过说 Fiddler 执行此操作时,提要可以正常工作,传递不记名令牌并调用它。但是,如果我使用 PowerBi 或 excel,它会给我这个错误:
DataSource.Error: Microsoft.Mashup.Engine1.Library.Resources.HttpResource: Request failed:
OData Version: 3 and 4, Error: The remote server returned an error: (400) Bad Request. (Bad Request)
OData Version: 4, Error: The remote server returned an error: (400) Bad Request. (Bad Request)
OData Version: 3, Error: The remote server returned an error: (400) Bad Request. (Bad Request)
Details:
DataSourceKind=OData
DataSourcePath=https://localhost:8401/odata/Persons
当我编辑数据源权限时,我尝试过匿名访问。我无法使用基本身份验证或组织帐户,因为它们不适用于 AzureAD。我已经使用 AllowAnonymous 设置了我的控制器,尽管我仍然在传递承载令牌并且它在 Fiddler 中工作:
[AllowAnonymous]
public class PersonsController : ODataController
{
public PersonsController()
{
}
[EnableQuery(PageSize = 20, AllowedQueryOptions = AllowedQueryOptions.All)]
public IQueryable<Persons> Get()
{
return new List<Persons>
{
new Persons
{
Forename = "john",
Surname = "smith"
},
new Persons
{
Forename = "john",
Surname = "smith"
}
}.AsQueryable();
}
}
解决方案
推荐阅读
- twilio - 我从 Twilio 神秘地收到 11200 错误(403 Forbidden on callback)
- r - 创建一个显示按年份发布的项目数量的图
- sql - 获取不同列中重复值的数量
- java - 我完全不知道如何开始,更不用说完成学校的编码项目了
- excel - 仅使用 VBA 将数据从 Excel 365 上传到 Azure Sql Server
- sql - 循环内的 SELECT 语句
- lua - 是否有针对本地用户的 Nil 值的修复
- laravel - 如何使用 laravel mix 和 webpack 将环境变量传递给 scss/sass 文件?
- javascript - CSS用字母填充div的整个宽度,而不改变字间距
- python-3.x - 如何使用 Selenium 和 BeautifulSoup 抓取页面然后执行按钮单击以转到下一页进行抓取