Getting MicrosoftOnlineException when website is hosted in IIS - powershell

There is a powershell script that gets called from asp.net .
The powershell basically connects to Windows Azure Module.
When I debug the asp.net from VS it gets hosted in IIs-express and the powershell script runs as expected.
But when the website is hosted in IIS, the below exception is being thrown
System.Management.Automation.InvalidPowerShellStateException occurred
HResult=-2146233087
Message=Microsoft.Online.Administration.Automation.MicrosoftOnlineException: Exception of type 'Microsoft.Online.Administration.Automation.MicrosoftOnlineException' was thrown.
Microsoft.Online.Administration.Automation.MicrosoftOnlineException: You must call the Connect-MsolService cmdlet before calling any other cmdlets.
Server stack trace:
at Microsoft.Online.Administration.Automation.BecWebServiceInspector.BeforeSendRequest(Message& request, IClientChannel channel)
at System.ServiceModel.Dispatcher.ImmutableClientRuntime.BeforeSendRequest(ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.PrepareCall(ProxyOperationRuntime operation, Boolean oneway, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IProvisioningWebService.GetRoleByName(GetRoleByNameRequest request)
at ProvisioningWebServiceClient.GetRoleByName(GetRoleByNameRequest request)
System.Management.Automation.ParameterBindingException: Cannot bind parameter 'RoleObjectId' to the target. Exception setting "RoleObjectId": "Object reference not set to an instance of an object." ---> System.Management.Automation.SetValueInvocationException: Exception setting "RoleObjectId": "Object reference not set to an instance of an object." ---> System.NullReferenceException: Object reference not set to an instance of an object.
at lambda_method(Closure , Object , Object )
at System.Management.Automation.ReflectionParameterBinder.BindParameter(String name, Object value)
--- End of inner exception stack trace ---
at System.Management.Automation.ReflectionParameterBinder.BindParameter(String name, Object value)
at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
--- End of inner exception stack trace ---
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Source=ManagementConsoleV2
StackTrace:
at ManagementConsoleV2.Structures.Lync_Online.PowershellWrapper.RunPowerShellScript(String userName, String plainPassword, PowerShellScriptType powerShellScriptType) in c:\Dev Team\Sameer\Trunk\Web\ManagementConsoleV2\Structures\Lync Online\PowershellWrapper.cs:line 64
InnerException:
When the application is run in IIS-express, the process runs in 32 bit mode. I have also hosted the application in both 32 bit/64 bit mode threadpool in IIS but getting the same error both time.

In IIS
Go to advanced settings of the application thread pool where your site is set to run in and Set
Load user Profile : true

Related

Automation scripts execution issue with Regression Suite Automation tool for Dynamics 365 application

I am trying to execute automation scripts in Regression Suite Automation tool(RSAT) and its throwing below error. I am using Dynamics 365 environment 10.0.26 and RSAT Version 2.4.11641.99.
**Status: Test case failed.
ERROR:
The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
DEBUG INFO:
System.ServiceModel.CommunicationObjectFaultedException
The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
Server stack trace:
at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposedOrNotOpen()
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at MS.Dynamics.Performance.Application.TaskRecorder.Create_a_vendorBase.TryToConnectToEnvironment(Int32 connectionRetryCount, Int32 connectionRetryDelayInMilliseconds)
at MS.Dynamics.Performance.Application.TaskRecorder.Create_a_vendorBase.TestSetup(Boolean verboseSnapshotsEnabled, Int32 actionTimeout, Boolean caseSensitiveValidation, Boolean groupComparison, Int32 pauseBetweenActions, String playbackDirectory, Int32 connectionRetryCount, Int32 connectionRetryDelayInMilliseconds)
**

MDriven | Error on UpdateDatabase, stack trace error below

Please note the below stack trace error we receive at times while updating the database.
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Eco.Wcf.Common.IPersistenceMapperWCF.EndUpdate(IAsyncResult result)
at Eco.Wcf.Common.WFCWrapProxyAndActSync.Update(Datablock datablock, UpdatePrecondition precondition, IdTranslationList& translationList, Int32& version, SyncVersion& syncVersion, UpdateResult& result)
at Eco.Wcf.Client.PersistenceMapperWCFClient.Eco.Persistence.IPersistenceMapper.Update(Datablock datablock, UpdatePrecondition precondition, IdTranslationList& translationList, Int32& version, SyncVersion& syncVersion, UpdateResult& result)
at Eco.Framework.DefaultImpl.PersistenceHandlerImpl.InternalUpdateDatabaseWithLocators(ICollection`1 LocatorsToUpdate, List`1 seensysasyncticketsthatpointsatnewobjects)
at Eco.Framework.DefaultImpl.PersistenceHandlerImpl.<>c__DisplayClass35_0.<UpdateDatabaseWithList>b__0()
at Eco.Services.Impl.AsyncSupportServiceImpl.WrapTaskInStandardExceptionHandling(Action task)
at Eco.Services.Impl.AsyncSupportServiceImpl.PerformTaskNowIfInAsyncThread(Action task)
at Eco.Framework.DefaultImpl.PersistenceHandlerImpl.UpdateDatabaseWithList(ICollection`1 LocatorsToUpdate)
at Eco.Services.Impl.PersistenceServiceImpl.UpdateDatabaseWithList[T](IEnumerable`1 list)
at RetroNET.SyncManager.ApplySyncPackage(XDocument syncPackage, ISiteSyncServiceProvider es)
Could you please assist further?
Thanks
The stack trace show an update operation failing - if this update is being executed towards a persistence mapper that currently is in an evolve process it is somewhat expected - if the schema change mid update there is no guarantee the update operation address things that exists after the evolve.
The current preferred way to communicate with the PeristenceMapper is over WebAPI as described here https://wiki.mdriven.net/index.php/WebApi
The Above stack trace seems to show you use the old WCF (WindowsCommunicationFoundation) way - but that is not important for the error I think.

OpsHub - User Mapping Screen throws error after long wait

Trying an OpsHub migration on TFS2013.3 to VSO, the utility fails on the User Mapping screen before any data can be shown. The screen's white areas stay blank and eventually after about 5 minutes, and error is thrown via an alert box.
OpsHub Version: Latest - downloaded and installed today, 1/23/2015.
The contents of my OSVMU.log file show this:
2015-01-23 14:00:41,442 [1] ERROR com.opshub.eai.metadata.MetadataException: OpsHub-014371: Could not instantiate metadata implementation for For User List | TFS Source 1422039041211 ALM TFS 1422039041213, due to ; nested exception is:
java.net.SocketTimeoutException: Read timed out
System.ServiceModel.FaultException: com.opshub.eai.metadata.MetadataException: OpsHub-014371: Could not instantiate metadata implementation for For User List | TFS Source 1422039041211 ALM TFS 1422039041213, due to ; nested exception is:
java.net.SocketTimeoutException: Read timed out
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at TFSMigrationUI.ViewModel.UserMappingViewModel.worker_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e) in e:\OVSMUBranch\TFSMigrationUI\ViewModel\UserMappingViewModel.cs:line 416
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
I don't know how or why, but I deleted the VSO server registration using Visual Studio, and re-added it back via Visual Studio, and this seemed to correct the ObsHub Utility, because now it correctly pulls in all the users / mappings.

Castle Windsor : Cycle detected in configuration

am using castle windsor via xml configurations.. and recently am getting this error after adding a new dependency in constructor input parameter.. any idea how i can provide an override in windsor dependency xml file..
Cycle detected in configuration.
Component class1 has a dependency on class2 but it doesn't provide an override.
You must provide an override if a component has a dependency on a service that it - itself - provides
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IOrderApplicationService.method1()
at OrderApplicationServiceClient.method1()
Have you tried the approach detailed in the documentation?

SOAP Security negotiation Error while calling Microsoft Dynamics CRM 2011 sdk IOrganizationServiceProxy web service

we have a virtual machine in our company that contains sqlserver and crm 2011 installed on It which we use It for testing our codes and I have written a simple webservice to call the sdk IOrganizationServieProxy webservice . on this Virtual machine my code works perfeclty with no error . BUT here is the situation : we have two other virtual machines , on one of them the sql server is installed and on the other one crm is installed and configured . the crm works fine but when I try to use my web service which calls the crm sdk IOrganizationServieProxy webservice webmethods I get the following errorr , any Ideas what could be wrong ? thanks in advance for anyone who answears this question .
System.ServiceModel.Security.SecurityNegotiationException: SOAP security negotiation with 'http://localhost/KN/XRMServices/2011/Organization.svc' for target 'http://localhost/KN/XRMServices/2011/Organization.svc' failed. See inner exception for more details. ---> System.ComponentModel.Win32Exception: The Security Support Provider Interface (SSPI) negotiation failed.
at System.ServiceModel.Security.WindowsSspiNegotiation.GetOutgoingBlob(Byte[] incomingBlob, ChannelBinding channelbinding, ExtendedProtectionPolicy protectionPolicy)
at System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState)
at System.ServiceModel.Security.IssuanceTokenProviderBase`1.GetNextOutgoingMessage(Message incomingMessage, T negotiationState)
at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
--- End of inner exception stack trace ---
Server stack trace:
at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Xrm.Sdk.IOrganizationService.RetrieveMultiple(QueryBase query)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.RetrieveMultipleCore(QueryBase query)
at KNCRMSearchWebService.searchContactsByNameAndFamilyName(String cl, String Name, String Family)
and here is an image from my visualstudio debug mode which shows the error :
It may not apply, but I have run into problems when the URL I used didn't match the WCF bindings set in the CRM Deployment Manager.
For instance, a server named "MyCRMServer" might be listening on port 80 at:
http://MyCrmServer/
...but if I had changed my CRM Server in Deployment Manager to url "crm.myCompany.com" then I have to use this URL to access web services:
http://crm.myCompany.com/