views:

165

answers:

2

I can work with many WCF bindings, except netMsmqBinding. All I get is:

CommunicationObjectFaultedException: "The communication object, System.ServiceModel.ServiceHost, cannot be used for communication because it is in the Faulted state."

at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)

I tried it in a Windows Server 2008 R2 with the following features installed

  • Message Queueing
  • Message Queueing Services
  • Message Queueing Server
  • Message Queueing Triggers
  • HTTP Support
  • Multicasting Support
  • Message Queueing DCOM Proxy

I tried also to add manually a private Message Queue in the Server Manager but it didn't work.

I am using a Windows Service to host my MSMQ. My Service Contract is

namespace MyCompany.Services
{
[ServiceContract(Name = "ServiceName",
                     Namespace = "http://MyCompany/ServiceName")]
public interface IServiceName
{
    [OperationContract(IsOneWay = true)]
    void Insert(MyData[] data);
}
[DataContract]
public class MyData
{
    [DataMember]
    public DateTime DateTime { get; set; }
    [DataMember]
    public double Lat { get; set; }
    [DataMember]
    public double Lon { get; set; }
    [DataMember]
    public TimeSpan Timespan { get; set; }
    [DataMember]
    public Guid Id { get; set; }
    [DataMember(IsRequired = false)]
    public int? Category { get; set; }
}
}

And my app.config contains

  <endpoint
      address="net.msmq://localhost/private/ServiceName"
      binding="netMsmqBinding"
      contract="MyCompany.Services.IServiceName"
      bindingConfiguration="tolerant"
      behaviorConfiguration="tolerant"
      />

and

<netMsmqBinding>
  <binding name="tolerant"
         maxReceivedMessageSize="2147483647"
         >
    <readerQuotas maxArrayLength="2147483647" />
    <security mode="None"/>
  </binding>
</netMsmqBinding>
+3  A: 

The best starting point would be Tom Hollander's three part blog post:

and have a good look at the MSDN docs on Queues in WCF - lots of stuff there, too!

The error you're getting would indicate some problem with the communication channel - something went wrong, the channel has been "faulted", i.e. rendered unusable. There's a ton of reasons that might happen, that's really hard to diagnose from afar with hardly any info.

Check out the resources and see if that helps you a step or two further - if not, we'll have to get a lot more info from you!

marc_s
I didn't install `MSMQ Active Directory Domain` as described in the post. I want it to work without security
Jader Dias
I finnaly installed it, but it didn't help. I guess I'll stop trying to host it on a Windows Service and I'll finally move it to IIS.
Jader Dias
A: 

How/where are you hosting your service and can you post your service contract and your web.config?

James Bender
@James edited the question to answer you
Jader Dias