简体   繁体   中英

Exception of type 'Microsoft.Online.Administration.Automation.MicrosoftOnlineException' was thrown

I'm using code on http://code.msdn.microsoft.com/office365/Office-365-Manage-users-by-cfc96d5e to connect to Office 365 via a test c# web application which basically connects to azure active directory and tries to execute couple of powershell cmdlets.

I'm getting this exception on the Pipeline.Invoke method on the Connect-MsolService cmdlet in my web app:

Exception of type 'Microsoft.Online.Administration.Automation.MicrosoftOnlineException' was thrown.

So far:

  • Followed instructions on this KB article: http://support.microsoft.com/kb/2494043
  • Installed/enabled the required software (NET Framework 3.5, Microsoft Online Services Sign-In Assistant (64 bit), Microsoft Online Services Module for Windows PowerShell (64 bit))
  • set-executionpolicy remotesigned
  • using non-federated primary admin account in office cloud to connect remote powershell
  • Using a Windows 2008 R2 64 bit machine.
  • Targeting 64 bit processor in VS, and .NET framework 4.0
  • IIS apppool for this web application is set to use .NET framework 4.0

I can successfully execute connect-msolservice and run cmdlets using the Microsoft Online Services Module for Windows PowerShell on the same machine, using same account.

What else can I try?

Change IIS App Pool setting Load User Profile to True

http://community.office365.com/en-us/forums/172/p/165426/474632.aspx#474632

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM