Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 在PowerBI或Excel中未连接Odata源_Asp.net_Excel_Odata_Powerbi - Fatal编程技术网

Asp.net 在PowerBI或Excel中未连接Odata源

Asp.net 在PowerBI或Excel中未连接Odata源,asp.net,excel,odata,powerbi,Asp.net,Excel,Odata,Powerbi,我在asp.net web api应用程序中设置了OData提要。该应用程序使用Azure AD进行身份验证,因此我计划在PowerBI脚本中传递承载令牌,如下所述: 当通过Fiddler这样做时,feed工作得很好,传递一个承载令牌并调用它。但如果我使用PowerBi或excel,则会出现以下错误: DataSource.Error: Microsoft.Mashup.Engine1.Library.Resources.HttpResource: Request failed: OData

我在asp.net web api应用程序中设置了OData提要。该应用程序使用Azure AD进行身份验证,因此我计划在PowerBI脚本中传递承载令牌,如下所述:

当通过Fiddler这样做时,feed工作得很好,传递一个承载令牌并调用它。但如果我使用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();
        }
    }
[AllowAnonymous]
公共类PersonController:ODataController
{
公共人员控制员()
{
}
[启用查询(PageSize=20,AllowedQueryOptions=AllowedQueryOptions.All)]
公共IQueryable Get()
{
返回新列表
{
新人
{
Forename=“约翰”,
姓氏=“史密斯”
},
新人
{
Forename=“约翰”,
姓氏=“史密斯”
}
}.AsQueryable();
}
}

不久前尝试过类似的方法,但运气不佳。我会关注你的进展…:)不久前也尝试过类似的方法,但运气不佳。我会关注你的进展…:)