Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2008

Tip: Looking for answers? Try searching our database.

CommunicationObjectFaultedException under Vista

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Danie Cigic - 20 Feb 2008 22:56 GMT
Hi

I changed from XP to Vista and now when my web client call service (WCF)
hosted by windows service I get CommunicationObjectFaultedException (it did
work fine under the XP). Service is using wsHttpBinding. I created a console
client to call same service and that works without any problems. Anyone with
same/similar problem?

Thanks.
Tiago Halm - 23 Feb 2008 19:06 GMT
Details on the exception would be useful, like stack trace, message and any
inner exception involved.

Tiago Halm

> Hi
>
[quoted text clipped - 5 lines]
>
> Thanks.
Daniel Cigic - 25 Feb 2008 15:18 GMT
Hi Tiago,

here are some more details:

Stack trace:

[CommunicationObjectFaultedException: The communication object,
System.ServiceModel.Channels.ServiceChannel, cannot be used for
communication because it is in the Faulted state.]
  System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg) +2668969
  System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type) +717
  System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout) +0
  System.ServiceModel.ClientBase`1.System.ServiceModel.ICommunicationObject.Close(TimeSpan
timeout) +177
  System.ServiceModel.ClientBase`1.Close() +38
  System.ServiceModel.ClientBase`1.System.IDisposable.Dispose() +4
  System.Web.UI.WebControls.ObjectDataSourceView.ReleaseInstance(Object
instance) +75
  System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments
arguments) +2176
  System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +92
  System.Web.UI.WebControls.ListControl.PerformSelect() +31
  System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
  System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
  System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +26
  System.Web.UI.Control.PreRenderRecursiveInternal() +86
  System.Web.UI.Control.PreRenderRecursiveInternal() +170
  System.Web.UI.Control.PreRenderRecursiveInternal() +170
  System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041

Here is service configuration:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
   <system.serviceModel>
       <behaviors>
           <serviceBehaviors>
               <behavior
name="Com.Fbfs.Eworld.Heimdall.ClientService.HeimdallServiceBehavior">
                   <serviceMetadata httpGetEnabled="true" />
                   <serviceDebug includeExceptionDetailInFaults="true" />
               </behavior>
           </serviceBehaviors>
       </behaviors>
       <services>
           <service
behaviorConfiguration="Com.Fbfs.Eworld.Heimdall.ClientService.HeimdallServiceBehavior"
               name="Com.Fbfs.Eworld.Heimdall.ClientService.HeimdallService">
               <endpoint address="" binding="wsHttpBinding"
contract="Com.Fbfs.Eworld.Heimdall.ClientService.IHeimdallService">
                   <identity>
                       <dns value="localhost" />
                   </identity>
               </endpoint>
               <endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
               <host>
                   <baseAddresses>
                       <add
baseAddress="http://localhost:8731/Design_Time_Addresses/Com.Fbfs.Eworld.Heimdall.ClientService/Service1/"
/>
                   </baseAddresses>
               </host>
           </service>
       </services>
   </system.serviceModel>
</configuration>

And web client configuration:

<system.serviceModel>
 <bindings>
     <wsHttpBinding>
       <binding name="WSHttpBinding_IHeimdallService"
closeTimeout="00:01:00"
           openTimeout="00:01:00" receiveTimeout="00:10:00"
sendTimeout="00:01:00"
           bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard"
           maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
           messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true"
           allowCookies="false">
         <readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
             maxBytesPerRead="4096" maxNameTableCharCount="16384" />
         <reliableSession ordered="true" inactivityTimeout="00:10:00"
             enabled="false" />
         <security mode="Message">
           <transport clientCredentialType="Windows"
proxyCredentialType="None"
               realm="" />
           <message clientCredentialType="Windows"
negotiateServiceCredential="true"
               algorithmSuite="Default" establishSecurityContext="true" />
         </security>
       </binding>
     </wsHttpBinding>
   </bindings>
 <client>
  <endpoint
address="http://localhost:8731/Design_Time_Addresses/Com.Fbfs.Eworld.Heimdall.ClientService/Service1/"
   binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IHeimdallService"
   contract="Com.Fbfs.Eworld.HeimdallClientService.IHeimdallService"
   name="WSHttpBinding_IHeimdallService">
   <identity>
    <dns value="localhost" />
   </identity>
  </endpoint>
 </client>
</system.serviceModel>

Console client (which doesn't throw exception) does have identical
configuration.

Thanks.

> Details on the exception would be useful, like stack trace, message and
> any inner exception involved.
[quoted text clipped - 10 lines]
>>
>> Thanks.
tiago.halm@gmail.com - 03 Mar 2008 20:53 GMT
From the exception you've shown, I suspect you are coding with "using"
when accessing the WCF generated proxy, right?

[CommunicationObjectFaultedException: The communication object,
System.ServiceModel.Channels.ServiceChannel, cannot be used for
communication because it is in the Faulted state.]

If so, then change the code to look like this:

Proxy c = new Proxy()
try
{
  c.CallMethod();
}
finally
{
  try { c.Close(); }
  catch(Exception) { c.Abort(); }
}

The original exception will bubble up and will tell you what caused
the error.

Tiago Halm

> Hi Tiago,
>
[quoted text clipped - 132 lines]
>
> - Show quoted text -
Daniel Cigic - 04 Mar 2008 14:51 GMT
I am not using "using" statement, the code looks like this:

partial class HeimdallClientService : ServiceBase
   {
       ServiceHost m_HmdlService;

       public HeimdallClientService()
       {
           InitializeComponent();
       }

       protected override void OnStart(string[] args)
       {
           StartService();
       }

       protected override void OnStop()
       {
           StopService();
       }

       protected override void OnPause()
       {
           StopService();
       }

       protected override void OnContinue()
       {
           StartService();
       }

       public static void Main()
       {
           ServiceBase.Run(new HeimdallClientService());
       }

       void StartService()
       {
           if (m_HmdlService != null)
               m_HmdlService.Close();

           m_HmdlService = new ServiceHost(typeof(HeimdallService));
           m_HmdlService.Open();
       }

       void StopService()
       {
           if (m_HmdlService != null)
           {
               m_HmdlService.Close();
               m_HmdlService = null;
           }
       }

   }

Thanks.

> From the exception you've shown, I suspect you are coding with "using"
> when accessing the WCF generated proxy, right?
[quoted text clipped - 162 lines]
>>
>> - Show quoted text -
tiago.halm@gmail.com - 04 Mar 2008 18:30 GMT
When I referred about the "using" keyword I was talking about the
client and the code you're showing is for the service, not for the
client. Can you paste the client code (only the piece where you
instantiate the proxy and you make the call is needed).

On another note ... could it be port 8731 is not open? I also wonder
if the WCF client call goes through the loopback adapter (127.0.0.1)
or the network adapter (filtered by the firewall, if open). TCPView
should help on figuring it out.

Tiago Halm

> I am not using "using" statement, the code looks like this:
>
[quoted text clipped - 230 lines]
>
> - Show quoted text -
Daniel Cigic - 06 Mar 2008 15:11 GMT
In debug mode I have seen something strange:

After calling first service method I don't get exception immediately.
I can even debug and see content of all variables thru the code below,
Service method returns right results.
First at the end of the code I am getting that exception. I also turned off
the firewall but
that didn't help either.

    void CreateTreeNodes()
    {
           TreeNodes treeNodes = new TreeNodes();
           List<SvnEntryInfo> infos = null;

               //This is my service proxy
               HeimdallServiceClient client = new HeimdallServiceClient();

               //service call
               // this goes good, no exception here
               // I can even see the content of the "infos" variable
               // First when I am up to leave this whole method
(CreateTreeNodes()) I am getting
               // CommunicationObjectFaultedException exception.
               infos = client.ListRepositoryPath("svn://esubversion/Misc",
254).ToList();

               foreach (var info in infos)
               {
                   Node node = new Node();
                   node.Path = info.Name.Split('/').ToList();
                   node.Entry = info;
                   treeNodes.Nodes.Add(node);
               }

              var levelNodes = from n in treeNodes.Nodes where n.Depth == 1
select n;

               foreach (var node in levelNodes)
               {
                   TreeNode tn = new TreeNode(node.Path.Last());
                   tn.PopulateOnDemand = true;
                   tn.ToolTip = GetFormatedToolTip(node);
                  TreeView1.Nodes.Add(tn);
               }
       }
}

Thanks.

> When I referred about the "using" keyword I was talking about the
> client and the code you're showing is for the service, not for the
[quoted text clipped - 244 lines]
>>
>> - Show quoted text -
tiago.halm@gmail.com - 06 Mar 2008 18:39 GMT
Daniel,

The code you've shown should not cause an error (although you're
missing the close/dispose method of the proxy).
I'd use Reflector and check the code. The debug/release version should
not affect, but I'm not sure.

Tiago Halm

> In debug mode I have seen something strange:
>
[quoted text clipped - 300 lines]
>
> - Show quoted text -

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.