You might get this error (The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.) if your Solution is working under any Source Control manager, like TFS, etc… Not joking…
This is the whole exception:
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.
Server stack trace:
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
Exception rethrown at :
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)
You might also see this error in the OutPut Window in VS.2010:
The program ‘ WaIISHost.exe: Managed (v4.0.30319)’ has exited with code -532462766 (0xe0434352).
This is a known issue with Windows Azure SDK 1.3 when upgrading from Windows Azure SDK 1.2 to 1.3. (It should be fixed in next WA Emulator version)
It is caused because the Compute Emulator tries to write into the .config file (though it updates nothing), and if your web.config is marked as read-only because of it is checked-in, the error will raise.
Another potential causes could be if multiple role instances are writing to same configuration file in the compute emulator.
Cause 1 – Web.config file marked read-only in compute emulator
In the SDK 1.3 release, this dialog box appears in the Windows Azure compute emulator when the web.config file is marked as read-only. The error does not occur when deploying to Windows Azure in the cloud, because file attributes are reset in any cloud deployment, thus making the web.config file writable. Note that the compute emulator does not copy the site’s content during execution.
Clear the read-only attribute from the web.config file. If you are using a source control system, you may need to check-out the file.
In SDK 1.3, the Windows Azure environment automatically configures the ASP.NET machine key on a per-site basis using the site’s web.config file. The automatically-supplied machine key is identical for all instances of a given site, but is different in all other cases (across deployments, etc.).
In prior releases, the machine key was set at the machine level.
Cause2 – Multiple role instances writing to same configuration file in compute emulator
This error may occur in the SDK 1.3 release when launching multiple instances of a given IIS-based web role. Since all instances refer to the same on-disk location, they attempt to write to the same web configuration file causing intermittent crashes during role startup.
Limit the instance count to one for any given role when using the compute emulator. Before deploying to Windows Azure, reset the instance count to a higher value as desired.
The problem is described in detail in MSDN: