首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在IIS主机上使用netMsmqBinding绑定时,WCF服务主机失败

在IIS主机上使用netMsmqBinding绑定时,WCF服务主机失败
EN

Stack Overflow用户
提问于 2012-03-18 01:55:47
回答 1查看 3.6K关注 0票数 2

使用IIS承载时WCF服务失败。服务的web.config为

代码语言:javascript
复制
<system.serviceModel>
    <bindings>
        <netMsmqBinding>
            <binding name="msmqbindingnontransactionalnonsecure" exactlyOnce="False">
                <security mode="None" />
            </binding>
        </netMsmqBinding>
    </bindings>
    <services>
        <service name="MsmqService.MsmqService">
            <endpoint address="net.msmq://localhost/private/msmqpoc/MsmqService.svc"  binding="netMsmqBinding" bindingConfiguration="msmqbindingnontransactionalnonsecure" contract="MsmqWCFService.IMsmqContract" />
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior>
                <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                <serviceMetadata httpGetEnabled="true"/>
                <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

服务合同是

代码语言:javascript
复制
[ServiceContract]
public interface IMsmqContract
{
    [OperationContract(IsOneWay = true)]
    void SendMessage(string message);
}

在IIS中承载服务时,将显示以下消息:

代码语言:javascript
复制
Server Error in '/msmqpoc' Application.
--------------------------------------------------------------------------------

Binding validation failed because the binding's ExactlyOnce property is set to true while the destination queue is non-transactional. The service host cannot be opened. Resolve this conflict by setting the ExactlyOnce property to false or creating a transactional queue for this binding. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Binding validation failed because the binding's ExactlyOnce property is set to true while the destination queue is non-transactional. The service host cannot be opened. Resolve this conflict by setting the ExactlyOnce property to false or creating a transactional queue for this binding.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.      
Stack Trace:
[InvalidOperationException: Binding validation failed because the binding's ExactlyOnce property is set to true while the destination queue is non-transactional. The service host cannot be opened. Resolve this conflict by setting the ExactlyOnce property to false or creating a transactional queue for this binding.]

配置已经设置为exactlyOnce=false,不确定为什么会出现这个错误,有什么帮助吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-03-18 17:50:52

我只能猜测您的服务没有获取正确的配置文件。我建议仔细检查一下。我看不出您发布的配置文件有任何问题。

稍微偏离主题,我建议您考虑一下为什么要使用非事务性队列。您使用它们的唯一原因是如果您的整体架构能够容忍消息丢失。

例如,在一些低延迟系统中,消息在无效之前最多只有几秒钟是有价值的。因此,在这种情况下,您不需要使用事务性队列。

如果不能容忍消息丢失,则必须使用事务性队列。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9752373

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档