{"id":693,"date":"2011-02-06T05:28:00","date_gmt":"2011-02-06T05:28:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/cesardelatorre\/2011\/02\/06\/how-to-fix-error-when-deploying-windows-azure-app-on-wa-sdk-v1-3-the-communication-object-system-servicemodel-channels-servicechannel-cannot-be-used-for-communication-because-it-is-in-the-faulted\/"},"modified":"2011-02-06T05:28:00","modified_gmt":"2011-02-06T05:28:00","slug":"how-to-fix-error-when-deploying-windows-azure-app-on-wa-sdk-v1-3-the-communication-object-system-servicemodel-channels-servicechannel-cannot-be-used-for-communication-because-it-is-in-the-faulted","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/how-to-fix-error-when-deploying-windows-azure-app-on-wa-sdk-v1-3-the-communication-object-system-servicemodel-channels-servicechannel-cannot-be-used-for-communication-because-it-is-in-the-faulted\/","title":{"rendered":"How to fix: Error when deploying Windows Azure App on WA SDK V1.3 &#8211; The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state."},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>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&hellip; Not joking&hellip; <img decoding=\"async\" style=\"border-style: none\" class=\"wlEmoticon wlEmoticon-winkingsmile\" alt=\"Winking smile\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1212.wlEmoticon-winkingsmile_63772F9B.png\" \/><\/p>\n<p><img decoding=\"async\" alt=\"Communication Object Faulted Exception\" src=\"http:\/\/i.msdn.microsoft.com\/dynimg\/IC457000.png\" \/><\/p>\n<p>This is the whole exception:<\/p>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" style=\"width: 837px\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"835\">\n<p><span style=\"font-size: xx-small\">System.ServiceModel.CommunicationObjectFaultedException was unhandled<\/span><\/p>\n<p><span style=\"font-size: xx-small\"> Message=The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.<\/span><\/p>\n<p><span style=\"font-size: xx-small\"> Source=mscorlib<\/span><\/p>\n<p><span style=\"font-size: xx-small\">&nbsp; StackTrace:<\/span><\/p>\n<p><span style=\"font-size: xx-small\">&nbsp;&nbsp;&nbsp; Server stack trace:<\/span><\/p>\n<p><span style=\"font-size: xx-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)<\/span><\/p>\n<p><span style=\"font-size: xx-small\">&nbsp;&nbsp;&nbsp; Exception rethrown at [0]:<\/span><\/p>\n<p><span style=\"font-size: xx-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)<\/span><\/p>\n<p><span style=\"font-size: xx-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)<\/span><\/p>\n<p><span style=\"font-size: xx-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)<\/span><\/p>\n<p><span style=\"font-size: xx-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at System.ServiceModel.ClientBase&#8217;1.System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)<\/span><\/p>\n<p><span style=\"font-size: xx-small\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Microsoft.WindowsAzure.Hosts.WaIISHost.Program.Main(String[] args)<\/span><\/p>\n<p><span style=\"font-size: xx-small\">&nbsp; InnerException:<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>You might also see this error in the OutPut Window in VS.2010:<\/p>\n<p>The program &#8216;[8880] WaIISHost.exe: Managed (v4.0.30319)&#8217; has exited with code -532462766 (0xe0434352).<\/p>\n<p><strong>This is a known issue with Windows Azure SDK 1.3 when upgrading from Windows Azure SDK 1.2 to 1.3. <\/strong>(It should be fixed in next WA Emulator version)<\/p>\n<p>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.<\/p>\n<p>Another potential causes could be if multiple role instances are writing to same configuration file in the compute emulator.<\/p>\n<p>&#8212;<\/p>\n<h6><span style=\"font-weight: bold\"><span style=\"text-decoration: underline\">Cause 1 &#8211; Web.config file marked read-only in compute emulator<\/span><\/span><\/h6>\n<p>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. <strong><span style=\"background-color: #ffff00\">The error does not occur when deploying to Windows Azure in the cloud<\/span><\/strong>, 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&rsquo;s content during execution.<\/p>\n<p><strong>Workaround<\/strong> <br \/><span style=\"background-color: #ffff00\">Clear the read-only attribute from the web.config file.&nbsp; If you are using a source control system, you may need to check-out the file.<\/span><\/p>\n<p><strong>Details<\/strong> <br \/>In SDK 1.3, the Windows Azure environment automatically configures the ASP.NET machine key on a per-site basis using the site&rsquo;s web.config file.&nbsp; The automatically-supplied machine key is identical for all instances of a given site, but is different in all other cases (across deployments, etc.).<\/p>\n<p>In prior releases, the machine key was set at the machine level.<\/p>\n<h6><span style=\"font-weight: bold\"><span style=\"text-decoration: underline\">Cause2 &#8211; Multiple role instances writing to same configuration file in compute emulator<\/span><\/span><\/h6>\n<p>This error may occur in the SDK 1.3 release when launching multiple instances of a given IIS-based web role.&nbsp; 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.<\/p>\n<p><strong>Workaround<\/strong> <br \/>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.<\/p>\n<p>&#8212;<\/p>\n<p>The problem is described in detail in MSDN:<\/p>\n<p><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/gg494981.aspx\">http:\/\/msdn.microsoft.com\/en-us\/library\/gg494981.aspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; 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&hellip; Not joking&hellip; This is the whole exception: System.ServiceModel.CommunicationObjectFaultedException was unhandled Message=The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because [&hellip;]<\/p>\n","protected":false},"author":362,"featured_media":12806,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[24],"class_list":["post-693","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cesardelatorre","tag-windows-azure"],"acf":[],"blog_post_summary":"<p>&nbsp; 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&hellip; Not joking&hellip; This is the whole exception: System.ServiceModel.CommunicationObjectFaultedException was unhandled Message=The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts\/693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/comments?post=693"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts\/693\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/media\/12806"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/media?parent=693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/categories?post=693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/tags?post=693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}