2015-04-23 12 views
0

我在VS 2013中開發了一個Office 365應用程序。通過連接的服務連接到我的O365帳戶。但是代碼被失敗以下行:辦公室365應用程序創建錯誤:類型'Microsoft.Office365.OAuth.MissingConfigurationValueException'的異常被拋出

_discoveryContext = await DiscoveryContext.CreateAsync(); 

而且我得到的例外是如下:

Exception of type 'Microsoft.Office365.OAuth.MissingConfigurationValueException' was thrown. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Microsoft.Office365.OAuth.MissingConfigurationValueException: Exception of type 'Microsoft.Office365.OAuth.MissingConfigurationValueException' was thrown. 

Source Error: 



Line 32:    if (_discoveryContext == null) 
Line 33:    { 
Line 34:     _discoveryContext = await DiscoveryContext.CreateAsync(); 
Line 35:    } 
Line 36: 


Source File: c:\Users\339933\Documents\Visual Studio 2013\Projects\WebApplicationMVC\WebApplicationMVC\Helper.cs Line: 34 

Stack Trace: 



[MissingConfigurationValueException: Exception of type 'Microsoft.Office365.OAuth.MissingConfigurationValueException' was thrown.] 
    Microsoft.Office365.OAuth.DiscoveryHelper.DiscoverAppIdentity() +601 
    Microsoft.Office365.OAuth.DiscoveryContext..ctor() +50 
    Microsoft.Office365.OAuth.<CreateAsync>d__2a.MoveNext() +381 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52 
    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24 
    WebApplicationMVC.<EnsureClientCreated>d__b.MoveNext() in c:\Users\339933\Documents\Visual Studio 2013\Projects\WebApplicationMVC\WebApplicationMVC\Helper.cs:34 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52 
    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24 
    WebApplicationMVC.<GetContacts>d__0.MoveNext() in c:\Users\339933\Documents\Visual Studio 2013\Projects\WebApplicationMVC\WebApplicationMVC\Helper.cs:20 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52 
    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24 
    WebApplicationMVC.Controllers.<Index>d__2.MoveNext() in c:\Users\339933\Documents\Visual Studio 2013\Projects\WebApplicationMVC\WebApplicationMVC\Controllers\HomeController.cs:22 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52 
    System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21 
    System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task) +61 
    System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +114 
    System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult) +66 
    System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +135 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102 
    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49 
    System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +117 
    System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +323 
    System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +44 
    System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +135 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102 
    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50 
    System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +72 
    System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185 
    System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +42 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +132 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56 
    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40 
    System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34 
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +138 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 
    System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44 
    System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +39 
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +62 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +138 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 
    System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39 
    System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39 
    System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39 
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +138 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 
    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40 
    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38 
    System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +129 
+0

我們是否需要在AD中進行額外的手動配置?意味着在Azure Active Directory中註冊。根據我的理解VS 2013做這個活動。 –

回答

0

這聽起來像所連接的服務嚮導莫名其妙地失敗。檢查您的Web.config文件。它應該具有以下鍵appSettings下:

<add key="ida:ClientID" value="SOME GUID HERE" /> 
<add key="ida:Password" value="SOME BASE64 STRING HERE" /> 
<add key="ida:AuthorizationUri" value="https://login.windows.net" /> 

如果他們丟失,您可能需要重新添加連接的服務。

+0

謝謝。但這些部分是存在的。我有所有3個鑰匙。 –

相關問題