【发布时间】:2010-05-04 21:25:47
【问题描述】:
我可以使用许多 WCF 绑定,netMsmqBinding 除外。我得到的只是:
CommunicationObjectFaultedException:“通信对象 System.ServiceModel.ServiceHost 无法用于通信,因为它处于故障状态。”
在 System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan 超时)
我在安装了以下功能的 Windows Server 2008 R2 中尝试过
- 消息队列
- 消息队列服务
- 消息队列服务器
- 消息队列触发器
- HTTP 支持
- 多播支持
- 消息队列 DCOM 代理
我也尝试在服务器管理器中手动添加私有消息队列,但没有成功。
我正在使用 Windows 服务来托管我的 MSMQ。 我的服务合同是
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; }
}
}
我的 app.config 包含
<endpoint
address="net.msmq://localhost/private/ServiceName"
binding="netMsmqBinding"
contract="MyCompany.Services.IServiceName"
bindingConfiguration="tolerant"
behaviorConfiguration="tolerant"
/>
和
<netMsmqBinding>
<binding name="tolerant"
maxReceivedMessageSize="2147483647"
>
<readerQuotas maxArrayLength="2147483647" />
<security mode="None"/>
</binding>
</netMsmqBinding>
【问题讨论】:
标签: wcf msmq netmsmqbinding