CommunicationObjectFaultedException under Vista

D

Danie Cigic

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.
 
T

Tiago Halm

Details on the exception would be useful, like stack trace, message and any
inner exception involved.

Tiago Halm
 
D

Daniel Cigic

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.
 
T

tiago.halm

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,

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.C­lose(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(DataSourceSele­ctArguments
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.HeimdallServi­ceBehavior"
                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...."/>
                    </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...."
    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.
Tiago Halm

- Show quoted text -
 
D

Daniel Cigic

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?

[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,

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.C­lose(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(DataSourceSele­ctArguments
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.HeimdallServi­ceBehavior"
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...."/>
</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...."
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.
Tiago Halm
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.- Hide quoted text -

- Show quoted text -
 
T

tiago.halm

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:

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?
[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,
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.C­­lose(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(DataSourceSele­­ctArguments
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.HeimdallServi­­ceBehavior"
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...."/>
</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...."
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.
Tiago Halm
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.- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
 
D

Daniel Cigic

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
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:

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?
[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,
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.C­­lose(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(DataSourceSele­­ctArguments
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.HeimdallServi­­ceBehavior"
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...."/>
</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...."
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.



Details on the exception would be useful, like stack trace, message
and
any inner exception involved.
Tiago Halm
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.- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
 
T

tiago.halm

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:

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
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:
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?
[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,
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.C­­­lose(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(DataSourceSele­­­ctArguments
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.HeimdallServi­­­ceBehavior"
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...."/>
</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...."
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.
Tiago Halm
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.- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,218
Latest member
JolieDenha

Latest Threads

Top