have a problem with Power BI Embedded. I want to embed a power BI report in a partial view. Following the guide, I created these methods on my controller:
public ActionResult Report()
{
credential = new UserCredential(username, passwordPowerBI);
Authorize().Wait();
ReportEmbed myReport = new ReportEmbed();
using (var client = new PowerBIClient(new Uri(apiUrl), tokenCredentials))
{
EmbedToken embedToken = client.Reports.GenerateTokenInGroup(groupId, reportID, new GenerateTokenRequest(accessLevel: "View"));
Report report = client.Reports.GetReportInGroup(groupId, reportID);
myReport.reportID = reportID;
myReport.embedURL = report.EmbedUrl;
myReport.embedToken = embedToken.Token;
}
return PartialView(myReport);
}
private static Task Authorize()
{
return Task.Run(async () => {
authenticationResult = null;
tokenCredentials = null;
var authenticationContext = new AuthenticationContext(authorityUrl);
authenticationResult = await authenticationContext.AcquireTokenAsync(resourceUrl, clientID, credential);
if (authenticationResult != null)
{
tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");
}
});
}
And in the view I just try to view my report. But the application go to this exception:
![enter image description here](https://i.stack.imgur.com/59djD.png)
(sorry, some text is in italian. "Impossibile trovare il metodo" means "Method not found").
What is the problem? Something is missing in the web.config?