2

IIS でホストしているときに WCF サービスが失敗します。サービスの web.config は次のとおりです。

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

サービス契約は、

[ServiceContract]
public interface IMsmqContract
{
    [OperationContract(IsOneWay = true)]
    void SendMessage(string message);
}

IIS でサービスをホストしているときに、次のメッセージが表示されます。

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

構成は既に exactOnce=false に設定されています。なぜこのエラーが発生するのかわかりません。何か助けはありますか?

4

1 に答える 1

2

私はあなたのサービスが正しい設定ファイルを取得していないと推測することしかできません。それを再確認することをお勧めします。投稿した設定ファイルに問題はありません。

少し話題から外れていますが、非トランザクションキューを使用している理由を検討する必要があるのは危険です。それらを使用する唯一の理由は、アーキテクチャ全体がメッセージの損失を許容できるかどうかです。

たとえば、一部の低遅延システムでは、メッセージは無効になるまでに最大で数秒間しか価値がありません。したがって、この場合、トランザクションキューを使用する必要はありません。

メッセージの損失を許容できない場合は、トランザクションキューイングを使用する必要があります。

于 2012-03-18T09:50:51.990 に答える