2017-02-17 3 views
0

Während der Integration von Power Bi in MVC (. NET-Rahmen arbeiten 4.6.2)Methode nicht gefunden: 'Microsoft.PowerBI.Api.V1.PowerBIClient..ctor (Microsoft.Rest.ServiceClientCredentials, System.Net.Http.DelegatingHandler [])'

Fehler unterschritten.

Methode nicht gefunden: Void Microsoft.PowerBI.Api.V1.PowerBIClient..ctor(Microsoft.Rest.ServiceClientCredentials, System.Net.Http.DelegatingHandler[]).

bei

var credentials = new TokenCredentials(accessKey, "AppKey"); 

var client = new PowerBIClient(credentials) 
{ 
    BaseUri = new Uri(apiUrl) 
}; 

installiert

Microsoft.PowerBI.Core 1.1.6.17045

Microsoft.Rest.ClientRuntime

Microsoft.PowerBI.Api 1.1.6.17045

Stacktrace:

bei DSLUI.Controllers.ReportsController.Index() in E: \ DM \ DSLServices \ DSLUI \ Controllers \ ReportsController.cs: Zeile 53 bei Lambda_method (Closure, ControllerBase, Objekt []) bei System.Web.Mvc .ActionMethodDispatcher.Execute (Controller Controller, Object [] Parameter) bei System.Web.Mvc.ReflectedActionDescriptor.Execute (Controllercontroller, IDictionary 2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary 2 Parameter) bei System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39 (IAsyncResult asyncResult, ActionInvocation innerInvokeState) bei System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult 2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase 1.End() bei System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod (IAsyncResult asyncResult) 0.123.bei System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3d() bei System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters. <> c__DisplayClass46.b__3f() bei System.Web.Mvc.Async.AsyncControllerActionInvoker. <> c__DisplayClass33.b__32 (IAsyncResult asyncResult) bei System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult 1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase 1.End() bei System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters (IAsyncResult asyncResult) bei System.Web .Mvc.Async.AsyncControllerActionInvoker. <> c__DisplayClass21. <> c__DisplayClass2b.b__1c() bei System.Web.Mvc.Async.AsyncControllerActionInvoker. <> c__DisplayClass21.b__1e (IAsyncResult asyncResult) bei System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult 1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase 1.End() bei System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction (IAsyncResult asyncResult) bei System.Web .Mvc.Controller.b__1d (IAsyncResult asyncResult, ExecuteCoreState Innerstate) bei System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid 1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase 1.End() bei System.Web.Mvc.Controller.EndExecuteCore (IAsyncResult asyncResult) bei System .Web.Mvc.Controller.b__15 (IAsyncResult asyncResult, Controller-Controller) bei System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid 1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase 1.End() bei System.Web.Mvc.Controll er.EndExecute (IAsyncResult asyncResult) bei System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute (IAsyncResult asyncResult) bei System.Web.Mvc.MvcHandler.b__5 (IAsyncResult asyncResult, ProcessRequestState Innerstate) bei System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid 1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase 1.End() bei System.Web.Mvc.MvcHandler.EndProcessRequest (IAsyncResult asyncResult) bei System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest (IAsyncResult result) bei System.Web.HttpApplication .CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() bei System.Web.HttpApplication.ExecuteStep (IExecutionStep Schritt, Boolean & completedSynchronously)

jede mögliche Hilfe bitte ..

+0

Haben Sie das gelesen Dokumentation oder durchsuchen Sie die Definition der Klasse 'PowerBIClient', um zu sehen, welche Parameter von diesem Konstruktor erwartet werden? –

+0

ja lesen doc und Beispielcode Download von hier https://docs.microsoft.com/en-us/azure/power-bi-embedded/power-bi-embedded-get-started-sample. und es funktioniert gut. In meinem Fall habe ich ein Projekt mit .net Framework 4.0 ich aktualisierte 4.6.2 und fügte hinzu, dlls, 0 build errors.but zur Laufzeit im bekommen diese Ausnahme. –

+0

Oh .. Ok .. Verstanden ... Erhalte Fehler in der Zeile 'var client = new PowerBIClient (credentials)' ?? Können Sie etwas mehr Informationen dazu geben? –

Antwort

1

Ausgabe mit dem System.Net .Http.dll reference, ich fand, das ist alte Version 2.xxx

Upgrade auf 4.0.0.0, dann sollte es in web.config wie unten sein

<dependentAssembly> 
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> 
    <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.0.0.0" /> 
    </dependentAssembly> 

Dann stand ich vor ein weiteres Problem

Compiler Error Message: CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. 

für dieses Add

<compilation debug="true" targetFramework="4.6.2"> 
    <assemblies>  
    <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
    </assemblies> 
</compilation> 
+0

Die Referenz gelöscht, damit es funktioniert :) Vielen Dank für Ihre Bemerkung Ich würde es nie alleine schaffen. –

Verwandte Themen