【发布时间】:2017-02-17 15:33:27
【问题描述】:
同时在mvc中集成Power bi(.net framework 4.6.2)
遇到错误。
找不到方法:Void Microsoft.PowerBI.Api.V1.PowerBIClient..ctor(Microsoft.Rest.ServiceClientCredentials, System.Net.Http.DelegatingHandler[])。
在
var credentials = new TokenCredentials(accessKey, "AppKey");
var client = new PowerBIClient(credentials)
{
BaseUri = new Uri(apiUrl)
};
已安装
Microsoft.PowerBI.Core 1.1.6.17045
Microsoft.Rest.ClientRuntime
Microsoft.PowerBI.Api 1.1.6.17045
堆栈跟踪:
在 E:\DM\DSLServices\DSLUI\Controllers\ReportsController.cs:line 53 中的 DSLUI.Controllers.ReportsController.Index()
在 lambda_method(闭包,ControllerBase,对象 [])
在 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase 控制器,Object[] 参数)
在 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext 控制器上下文,IDictionary2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 参数)
在 System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult asyncResult,ActionInvocation innerInvokeState)
在 System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
在 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
在 System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3d()
在 System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.c__DisplayClass46.b__3f()
在 System.Web.Mvc.Async.AsyncControllerActionInvoker.c__DisplayClass33.b__32(IAsyncResult asyncResult)
在 System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
在 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
在 System.Web.Mvc.Async.AsyncControllerActionInvoker.c__DisplayClass21.c__DisplayClass2b.b__1c()
在 System.Web.Mvc.Async.AsyncControllerActionInvoker.c__DisplayClass21.b__1e(IAsyncResult asyncResult)
在 System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
在 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
在 System.Web.Mvc.Controller.b__1d(IAsyncResult asyncResult,ExecuteCoreState innerState)
在 System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
在 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
在 System.Web.Mvc.Controller.b__15(IAsyncResult asyncResult,控制器控制器)
在 System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
在 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
在 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
在 System.Web.Mvc.MvcHandler.b__5(IAsyncResult asyncResult,ProcessRequestState innerState)
在 System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
在 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
在 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult 结果)
在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
请帮忙..
【问题讨论】:
-
您是否阅读过文档或浏览类
PowerBIClient的定义以查看它的构造函数需要哪些参数? -
是的,从这里docs.microsoft.com/en-us/azure/power-bi-embedded/… 阅读文档和示例代码下载。并且工作正常。在我的情况下,我有一个具有 .net 框架 4.0 的项目,我更新了 4.6.2 并在 dll 之上添加,0 构建错误。但在运行时我得到了这个异常。
-
哦.. 好的.. 明白了...
var client = new PowerBIClient(credentials)行出现错误??你能提供更多关于它的信息吗? -
在调试时,当光标到达这个地方时,在 catch 块中引发了一个异常。光标甚至不执行行 var client = new PowerBIClient(credentials)
标签: c# .net asp.net-mvc powerbi powerbi-embedded