CommunicationObjectFaultedException when debugging Azure - debugging

When attempting to start the debugger on an otherwise perfectly functional Azure project, what can cause the following exception to occur?
System.ServiceModel.CommunicationObjectFaultedException
was unhandled Message=The
communication object,
System.ServiceModel.Channels.ServiceChannel,
cannot be used for communication
because it is in the Faulted state.
Source=mscorlib StackTrace:
Server stack trace:
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan
timeout)
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 System.ServiceModel.ICommunicationObject.Close(TimeSpan
timeout)
at System.ServiceModel.ClientBase`1.System.ServiceModel.ICommunicationObject.Close(TimeSpan
timeout)
at Microsoft.WindowsAzure.Hosts.WaIISHost.Program.Main(String[]
args) InnerException:

For me, the problem was that my startup project for debugging was set to the package project (i.e. the project containing the service definition files) rather than one of my web roles. (This got reset when I changed machines.) Right-clicking on a web role and selecting "Set as StartUp Project" fixed the error.
In case you don't notice the comment above, #smarx also mentions that a common cause for the same error is a read-only web.config file and points to http://msdn.microsoft.com/en-us/library/gg494981.aspx. That same link mentions a couple other related causes too.

Related

Websocket SignalR does not start

I just deployed a MVC web app to my windows server 2012. It has Windows 8 and IIS v8 installed. The application uses SignalR, and I would like to use websockets, but it gives errors.
In every browser (chrome ff, ie) the error is the same:
"NetworkError: 500 Internal Server Error - https://domain.com/signalr/connect?transport=webSockets&connectionToken=wiiR333%2BkbKu0Ex2SPZLE9W9X6eAm5lBssbjXbqCvl0QpjAiGtHkn1xiIQHYGi3O4DDLIv7whTahVb8Ll5kfwjnrzaZaDYCApWj5aWm6d1cZzxH89K%2BouHziBH7dCt9I&connectionData=%5B%7B%22name%22%3A%22charthub%22%7D%5D&tid=8"
The detailed error message would be:
Exception information:
Exception type: InvalidOperationException
Exception message: Not a valid web socket request.
at Microsoft.AspNet.SignalR.Transports.WebSocketTransport.AcceptWebSocketRequest(Func`2 callback)
at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext context)
at Microsoft.AspNet.SignalR.Hubs.HubDispatcher.ProcessRequest(HostContext context)
at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(IDictionary`2 environment)
at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I asked in the SignalR Jabbr chat what the error would be and they told me something is blocking the connections. I checked, and both TCP port 80 and port 443 are listening.
The IIS trust level is Full (internal) and we're not using loadbalancing. The Websockets protocol is installed.
What could be wrong?

Test Rig Azure Controller cannot connect to Visual Studio Client

I am deploying a test rig as per the directions from http://msdn.microsoft.com/en-us/library/windowsazure/hh674491.aspx with the controller and agents hosted on windows azure. I have followed all the directions properly and my VS client is able to see the controller and agents. However when i execute a load test, the test remains in an pending state and I see the below error in the Controller's eventlog. My problem is similar to one found at: http://social.msdn.microsoft.com/Forums/en-US/windowsazureconnectivity/thread/4040619f-5667-4445-804a-84f37d823c9f/. Please help!
(QTController.exe, PID 692, Thread 11) ControllerDeployment.DoDeployment: System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond [xxx:xxx:xxxx:xxx:xxxx:xxxx:xxxx:220]:6915
Server stack trace:
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
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.VisualStudio.TestTools.Common.FileCopyService.get_DeploymentFlags()
at Microsoft.VisualStudio.TestTools.Controller.ControllerExecution.b__6(FileCopyService fileCopyService)
at Microsoft.VisualStudio.TestTools.Execution.RemoteObjectContainer1.InvokeAsRemoteUser(Action1 invoke)
at Microsoft.VisualStudio.TestTools.Controller.ControllerExecution.DoDeployment()
Based on the error message it looks like the controller is not able to talk to the agent. Have you set up a connect group as mentioned below:
"http://msdn.microsoft.com/en-us/library/windowsazure/hh674497.aspx"
Creating a Connect Group
The Connect feature of Azure allows you to create a Virtual Private Network. Members of the group can include on-premise computers as well as Azure role instances. For the Load Test solution, the Connect group allows communication between the test controller and the agents.
Attempted this as well, and couldn't get it to work. Ended up having to move the Controller into Azure as well.
I followed the documentation as far as what ports the agent needed, and opened those up in the Azure firewall. However, after doing a network capture, IIRC it also used some dynamic ports that weren't going to work to open up.
So I found that I had to move Visual Studio, the Load Agent Controller, and the Load Agents themselves all into Azure to utilize this in the cloud.

Impersonation okay local but not on server

I am having a problem with I think impersonation, but I could be mistaken.
I have an IBM XMS consumer, consuming data from a queue. Works fine. In order to be granted access to the queue the service needs to be running as specific user, for this I have implemented .Net impersonation. On all systems I am able to get the queue running, the problem occurs when there is a need to restart.
To test restart I have placed a simple if(messages == 500) throw... which triggers cancellation, disconnection and reconnection.
I installed the application as a Windows service to my local machine, it connects (using impersonation), reaches 500, throws, disconnects, reconnects and continues to process messages. However when I run the same code on our server it fails while trying to create a queue connection. Here is the error:
7765 [20] ERROR SIS (null) - Unable to connect to Websphere MQ
IBM.XMS.XMSException: CWSMQ0006E: An exception was received during the
call to the method ConnectionFactory.CreateConnection:
System.ComponentModel.Win32Exception (0x80004005): Access is denied
at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId,
Int32 access, Boolean throwIfExited) at
System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId,
Boolean firstModuleOnly) at
System.Diagnostics.ProcessManager.GetModuleInfos(Int32 processId)
at System.Diagnostics.Process.get_Modules() at
IBM.WMQ.CommonServices.TraceEnvironment() at
IBM.WMQ.CommonServices.CreateCommonServices() at
IBM.WMQ.CommonServices.TraceEnabled() at IBM.WMQ.MQBase..ctor()
at IBM.WMQ.Nmqi.Phconn..ctor(NmqiEnvironment env) at
IBM.WMQ.Nmqi.NmqiEnvironment.NewPhconn() at
IBM.XMS.Client.WMQ.WmqConnection..ctor(NmqiEnvironment nmqiEnv, NmqiMQ
nmqiMQ, XmsPropertyContext connectProps) at
IBM.XMS.Client.WMQ.Factories.WmqConnectionFactory.CreateV7ProviderConnection(XmsPropertyContext
connectionProps). During execution of the specified method an
exception was thrown by another component. See the linked exception
for more information. at
IBM.XMS.Client.WMQ.Factories.WmqConnectionFactory.CreateProviderConnection(XmsPropertyContext
connectionProps) at
IBM.XMS.Client.Impl.XmsConnectionFactoryImpl.CreateConnection(String
userID, String password) at
IBM.XMS.Client.Impl.XmsConnectionFactoryImpl.CreateConnection() at
Spin.TradingServices.DataAcquisition.Domain.DataProcessing.SIS.SISMQConnection.Connect(ImpersonationCredentials
impersonationCredentials)
Linked Exception : System.ComponentModel.Win32Exception (0x80004005):
Access is denied at
System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32
access, Boolean throwIfExited) at
System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId,
Boolean firstModuleOnly) at
System.Diagnostics.ProcessManager.GetModuleInfos(Int32 processId)
at System.Diagnostics.Process.get_Modules() at
IBM.WMQ.CommonServices.TraceEnvironment() at
IBM.WMQ.CommonServices.CreateCommonServices() at
IBM.WMQ.CommonServices.TraceEnabled() at IBM.WMQ.MQBase..ctor()
at IBM.WMQ.Nmqi.Phconn..ctor(NmqiEnvironment env) at
IBM.WMQ.Nmqi.NmqiEnvironment.NewPhconn() at
IBM.XMS.Client.WMQ.WmqConnection..ctor(NmqiEnvironment nmqiEnv, NmqiMQ
nmqiMQ, XmsPropertyContext connectProps) at
IBM.XMS.Client.WMQ.Factories.WmqConnectionFactory.CreateV7ProviderConnection(XmsPropertyContext
connectionProps)
Looks like the user id being impersonated does not have enough permissions and not a problem with XMS.
Here is a link that may be of help to you.
Access is denied at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
and this also.
It seems that on the IBM site there is a fix available for this error:
http://www-01.ibm.com/support/docview.wss?uid=swg1IC90674
(please use the Wayback Machine https://archive.org/web/ if the URL is no longer available)
They also say that there is a local fix:
Granting "Query process information and read process virtual
memory" rights to the impersonated user so that OpenProcess
succeeds.

Azure AppFabric caching. ErrorCode<ERRCA0017>:SubStatus<ES0006>

there is a very strange thing going on
i have a web site made in MVC 3 deployed in an Azure WebRole
it was running fine and originally was made in VS2010
now i use VS2012
i decided to make some minor changes and it appeared to be working but keeps break down at random intervals
this is what is happening
after random intervals i get this error ErrorCode<ERRCA0017>:SubStatus<ES0006>
after 2-3 minutes of getting this error sites appears to be working fine
i havent changed anything from the previous version of the site related to caching
this error does nt happens when i test it in staging or in local environment
no where in my code im accessing this cache programmatically
i have copy-pasted entire configuration as it is from the azure portal and i know it it correct because these are the same configuration settings that were working before
i just using Azure AppFabric Caching because i need to save sessions some where. so the only place it is ever mentioned is in my websites web config and as i have told all the configuration can be assumed to be correct.
this is the stacktrace if this can be of some help
[DataCacheException: ErrorCode<ERRCA0017>:SubStatus<ES0006>:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.)]
Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody) +616
Microsoft.ApplicationServer.Caching.DataCache.ExecuteAPI(RequestBody reqMsg, IMonitoringListener listener) +29
Microsoft.ApplicationServer.Caching.DataCache.InternalGetAndLock(String key, TimeSpan timeout, DataCacheLockHandle& lockHandle, String region, Boolean lockKey, IMonitoringListener listener) +227
Microsoft.ApplicationServer.Caching.<>c__DisplayClass78.<GetAndLock>b__77() +103
Microsoft.ApplicationServer.Caching.DataCache.GetAndLock(String key, TimeSpan timeout, DataCacheLockHandle& lockHandle) +258
Microsoft.Web.DistributedCache.<>c__DisplayClass31`1.<PerformCacheOperation>b__30() +19
Microsoft.Web.DistributedCache.DataCacheRetryWrapper.PerformCacheOperation(Action action) +208
Microsoft.Web.DistributedCache.DataCacheForwarderBase.GetAndLock(String key, TimeSpan timeout, DataCacheLockHandle& lockHandle) +190
Microsoft.Web.DistributedCache.BlobBasedSessionStoreProvider.GetItem(HttpContextBase context, String id, Boolean acquireWriteLock, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) +593
Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) +125
System.Web.SessionState.SessionStateModule.GetSessionStateItem() +178
System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +1076
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +115
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
UPDATE:-
suddenly i discovered a new error which seems to me as one of the inner errors many sites talk about
error description
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond [IP-Address]:[PORT]
and this is the new stack trace
[SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond [IP-ADDRESS]:[PORT]]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +305
System.Net.Sockets.Socket.Connect(EndPoint remoteEP) +162
System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout) +774
[EndpointNotFoundException: Could not connect to [SOCKET-ENDPOINT]. The connection attempt lasted for a time span of 00:00:21.0308462. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 111.221.89.111:22233. ]
System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase) +518
System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData) +401
Microsoft.ApplicationServer.Caching.OpenDelegate.EndInvoke(IAsyncResult result) +0
Microsoft.ApplicationServer.Caching.ChannelContainer.Opened(IAsyncResult ar) +122
There was an interesting blog post about this error over a year ago: Azure AppFabric Caching - ErrorCode:SubStatus : What to do?.
Before intializing the DataCacheFactory modify the
DataCacheFactoryConfiguration.ChannelOpenTimeout of the
dataCacheFactoryConfiguration instance that you are using to a larger
value of 2 minutes. (can't use configuration to set the value, since
20 seconds in the allowed limit) . Also, this recommendation is only
for debugging purposes and ideally should not be needed in production
environments. This lets the underlying layer to respond back with the actual error
that occurred. Now, if you check the inner exception, you should see
what caused the request to fail.
Please follow these steps to find the inner exception which will explain why the request fails.
Note: If this is caused by a transient fault, you should consider using the Transient Fault Handling Application Block (which also supports AppFabric Cache) in order to implement a retry policy.

.net remoting in Vista

I've got an application that communicates with a wndows service via .net remoting.
Under XP this is all fine but when I run the same code on Vista I get the exception
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8969
Server stack trace:
at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(AddressFamily family)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
at System.Runtime.Remoting.Channels.RemoteConnection.GetSocket()
at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
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)
I've tried turning the firewall off, running the service in the same user context as the user that is logged in to no avail.
Is there something about Vista that doesn't allow communication between services and user applications via .net remoting?
Has anyone else seen this?
I never came up with a resolution for this. But instead of using tcp for remoting, I used the ipc protocol that came with .net 2.0 (this was a converted project from 1.1).
Specifying the authorized group got around this issue:
<system.runtime.remoting>
<application name="MyService">
<service>
<wellknown type="MyAssembly.MyServiceProxy, MyService" objectUri="FrontdeskSyncService.rem" mode="Singleton" />
</service>
<channels>
<channel ref="ipc" portName="server" authorizedGroup="Everyone">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>

Resources