2011-12-17 4 views
0

私としばらくお待ちください、画像全体をレイアウトしたいです。 COMオブジェクト(VB6マクロ)がアプリケーションメソッドを呼び出すときに、ウィンドウを開いて表示する必要があるWPFアプリケーション(.exe)があります。私は1つのマネージドコードプロジェクトを.exeソリューションCOMで可視化し、VB6マクロはこのマネージコードプロジェクト(COMスタブ)でメソッドを正常に呼び出します。WPFアプリケーションとWCFクライアント/サービスエンドポイント要素を見つけることができません

私のCOMスタブはメソッド呼び出しを受け取り、最初にコマンドライン引数で渡すWPF exeでProcess.Startを実行します。私のアプリケーションは期待どおりに起動します。私は今、VB6マクロから、私のCOMスタブを介して、連続した呼び出しでWPFのexeにデータを送信する必要があります。 WPF exeソリューションに「netNamedPipeBinding」サービスを生成するWCFプロジェクトを追加しました。 COMスタブにServiceReferenceを追加して、WPF exeと通信しました。私はWCFサービスをコンソールアプリケーションで個別にテストしています。私はテストケースと同じメタデータアドレスを使用してCOMスタブServiceReferenceを構築しました。

私のテストドライバはCOMスタブメソッドを呼び出し、WPFアプリケーションが起動します。次回COMスタブへの呼び出しでサービスクライアントのインスタンス化が試行され、恐ろしいエラーが表示されます。 「ServiceModelクライアント構成セクションで、名前が「内部」で、エンドポイント要素が「SelectedStudentReference.ISelectedStudent」と一致しませんでした。

私のapp.configの内容は、WCFサービスプロジェクトのWPF exeソリューションの一部です。

<system.serviceModel> 
    <bindings /> 
    <client /> 
    <services> 
    <service name="AwardManager.Service.SelectedStudentService"> 
     <host> 
     <baseAddresses> 
      <!--<add baseAddress = "http://localhost:8080/SelectedStudent" />--> 
      <add baseAddress="net.pipe://localhost/SelectedStudent" /> 
     </baseAddresses> 
     </host> 
     <endpoint 
      name="internal" 
      address="net.pipe://localhost/" 
      binding="netNamedPipeBinding" 
      contract="AwardManager.Service.ISelectedStudent" 
     /> 
     <endpoint 
     address="mex/pipes" 
     binding="mexNamedPipeBinding" 
     contract="IMetadataExchange" 
     /> 
    </service> 
    </services> 
    <behaviors> 
    <serviceBehaviors> 
     <behavior> 
     <serviceMetadata httpGetEnabled="False"/> 
     <serviceDebug includeExceptionDetailInFaults="False" /> 
     </behavior> 
    </serviceBehaviors> 
    </behaviors> 
</system.serviceModel> 

これをWPF app.configにコピーしてみましたが、これは成功しませんでした。このサービスは、コンソールアプリケーションのテストドライバで動作します。これがWCFでの私の最初の経験であるため、次のトラブルシューティングの段階で迷っています。私はanother Stackflow questionを見ましたが、それが私のケースに適用されているかどうかわかりませんでした。何か案は?

答えて

0

いつもあなたが見る最後の場所です。私のコンソールアプリケーションのテストドライバは、ServiceReferenceを運ぶCOMスタブを呼び出していました。 ServiceClientを作成した呼び出しの直前に、このコード行を追加しました。

string dir = System.IO.Directory.GetCurrentDirectory(); 

これは、テストドライバディレクトリにクライアントが作成されていることを示しています。これを私のCOMスタブからテストドライバ用のapp.configにコピーしました。今、チャンピオンのように働く。

<system.serviceModel> 
    <bindings> 
     <netNamedPipeBinding> 
     <binding name="internal" closeTimeout="00:01:00" openTimeout="00:01:00" 
      receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" 
      transferMode="Buffered" transactionProtocol="OleTransactions" 
      hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" 
      maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536"> 
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
       maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="Transport"> 
       <transport protectionLevel="EncryptAndSign" /> 
      </security> 
     </binding> 
     </netNamedPipeBinding> 
    </bindings> 
    <client> 
     <endpoint 
     address="net.pipe://localhost/" 
     binding="netNamedPipeBinding" 
     bindingConfiguration="internal" 
     contract="SelectedStudentReference.ISelectedStudent" 
     name="internal"> 
     <identity> 
      <userPrincipalName value="[email protected]" /> 
     </identity> 
     </endpoint> 
    </client> 
</system.serviceModel> 
0

これが私の解決策につながった:それは「子」(WPF)プロジェクトで見つけることができる、「メイン」app.configファイルにサービスrefのものを移動します。

関連する問題