1

「Service Broker External Activator」サービスで使用するコンソール アプリケーションを作成しました。「C:\Program Files\Service Broker\External Activator\Config」内の設定ファイルを変更しましたが、以下のようにログファイルに例外を書き込みます

EXCEPTION ERROR = 32、キューに代わって有効なアプリケーション モニターがありません

これが私の構成です

<NotificationServiceList>
    <NotificationService name="ExternalActivatorService" id="100" enabled="true">
      <Description>My test notification service</Description>
      <ConnectionString>
        <!-- All connection string parameters except User Id and Password should be specificed here -->
        <Unencrypted>Data Source=localhost;Initial Catalog=Chapter4_ExternalActivation;Application Name=External Activator;Integrated Security=True;</Unencrypted>
      </ConnectionString>
    </NotificationService>
  </NotificationServiceList>
  <ApplicationServiceList>
        <ApplicationService name="ProcessingApplication" enabled="true">
      <OnNotification>
        <ServerName>localhost</ServerName>
        <DatabaseName>Chapter4_ExternalActivation</DatabaseName>
        <SchemaName>dbo</SchemaName>
        <QueueName>ExternalActivatorQueue</QueueName>
      </OnNotification>
      <LaunchInfo>
        <ImagePath>D:\Temp\ServiceBroker\9781590599990\Samples\Chapter4\02 ExternalProcessingApplication\ProcessingApplication\bin\Debug\ProcessingApplication.exe</ImagePath>
        <CmdLineArgs></CmdLineArgs>
        <WorkDir>D:\Temp\ServiceBroker\9781590599990\Samples\Chapter4\02 ExternalProcessingApplication\ProcessingApplication\bin\Debug</WorkDir>
      </LaunchInfo>
      <Concurrency min="1" max="1" />
    </ApplicationService>
  </ApplicationServiceList>

そして、ここにSQLがあります

CREATE DATABASE Chapter4_ExternalActivation
GO

ALTER DATABASE Chapter4_ExternalActivation
      SET ENABLE_BROKER;
GO

USE Chapter4_ExternalActivation
GO

--*********************************************
--*  Create the message type "RequestMessage"
--*********************************************
CREATE MESSAGE TYPE
[http://ssb.csharp.at/SSB_Book/c04/RequestMessage]
VALIDATION = WELL_FORMED_XML
GO

--*********************************************
--*  Create the message type "ResponseMessage"
--*********************************************
CREATE MESSAGE TYPE
[http://ssb.csharp.at/SSB_Book/c04/ResponseMessage]
VALIDATION = WELL_FORMED_XML
GO

--************************************************
--*  Create the contract "HelloWorldContract"
--************************************************
CREATE CONTRACT [http://ssb.csharp.at/SSB_Book/c04/HelloWorldContract]
(
    [http://ssb.csharp.at/SSB_Book/c04/RequestMessage] SENT BY INITIATOR,
    [http://ssb.csharp.at/SSB_Book/c04/ResponseMessage] SENT BY TARGET
)
GO

 --********************************************************
--*  Create the queues "InitiatorQueue" and "TargetQueue"
--*********************************************************
CREATE QUEUE InitiatorQueue
WITH STATUS = ON
GO

CREATE QUEUE TargetQueue
GO

 --**************************************************************
--*  Create the services "InitiatorService" and "TargetService"
--***************************************************************
CREATE SERVICE InitiatorService
ON QUEUE InitiatorQueue 
(
    [http://ssb.csharp.at/SSB_Book/c04/HelloWorldContract]
)
GO

CREATE SERVICE TargetService
ON QUEUE TargetQueue
(
    [http://ssb.csharp.at/SSB_Book/c04/HelloWorldContract]
)
GO

 --******************************************************************
--*  Deactivate the internal activation on the queue (if necessary)
--*******************************************************************
ALTER QUEUE TargetQueue
    WITH ACTIVATION (DROP)
GO

--*********************************************
--*  Create the event notification queue
--*********************************************
CREATE QUEUE ExternalActivatorQueue
GO

--*********************************************
--*  Create the event notification service
--*********************************************
CREATE SERVICE ExternalActivatorService
ON QUEUE ExternalActivatorQueue
(
    [http://schemas.microsoft.com/SQL/Notifications/PostEventNotification]
)
GO

--***********************************************************************
--*  Subscribe to the QUEUE_ACTIVATION event on the queue "TargetQueue"
--***********************************************************************
CREATE EVENT NOTIFICATION EventNotificationTargetQueue
    ON QUEUE TargetQueue
    FOR QUEUE_ACTIVATION
    TO SERVICE 'ExternalActivatorService', 'current database';
GO

TargetService にメッセージを送信すると、ExternalActivatorQueue に新しいメッセージが届きます。「Service Broker External Activator」サービスを開始すると、エラーが表示されます。この問題の原因を突き止める方法はありますか?

4

2 に答える 2

1

この原因として最も可能性が高いのは、ServerName 要素で「localhost」を使用していることです。ServerName を localhost に変更して、実際の例でそれを再現しました。

ServerName と ConnectionString のサーバーは、DNS 名でもなく、実際のコンピューター名、具体的にはマシン名でなければなりません。

ConnectionString のサーバーを localhost にすると、サービスの開始後に何も起こりません。エラーは発生しませんが、アクティベーションは行われません。

于 2015-10-21T19:43:04.470 に答える