2012-03-14 8 views
1

私はVS2010でWCFアプリケーションを開発しています。 IDE内のデバッガを使用してホストアプリケーションとクライアントを実行すると、すべてが意図どおりに機能します。WCF SocketException

私は(/ binに/デバッグ/フォルダへ行く)手動で2つの実行を実行したときしかし、私はクライアントからの次の例外を取得:

System.Net.Sockets.SocketException:いいえ接続が可能ことができませんでしたターゲットマシンが積極的127.0.0.1:8732

を拒否したため、奇妙なことには、app.configファイルで私は8732.

何が問題になっています、ポート5000を使用しないように指定していされて作ったのですか?前もって感謝します。

編集:ここでは、ホストアプリケーションのためのapp.configです:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 

    <system.web> 
    <compilation debug="true" /> 
    </system.web> 
    <!-- When deploying the service library project, the content of the config file must be added to the host's 
    app.config file. System.Configuration does not support config files for libraries. --> 
    <system.serviceModel> 
    <services> 
     <service name="WCFServiceLibrary.SavalotServiceObject"> 
     <endpoint address="" binding="wsHttpBinding" contract="WCFServiceLibrary.ISavalotService"> 
      <identity> 
      <dns value="localhost" /> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:5000/Design_Time_Addresses/WCFServiceLibrary/SavalotServiceObject/" /> 
      </baseAddresses> 
     </host> 
     </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> 
    </system.serviceModel> 

</configuration> 
+2

ctrl + F5を押してデバッグせずに実行するとどうなりますか? – deltree

+0

@deltree同じエラーです。 – Xenoprimate

+1

あなたの問題は、設定ファイルにデバッグ固有の設定があることです。 – deltree

答えて

4

は、ユーザーが、この場合は13 COMMENTS

を通過する必要はありませんので、問題は、ユーザーがマルチプロジェクトソリューションを実行していたということでした投稿しました。その場合、どのプロジェクトが実行されているのかは、設定​​ファイルが重要なプロジェクトです。

あなたが WcfServiceを実行しているている場合は、右のポートを使用するように構成されたそのweb.configファイルを持っていることで、サービスとのプロジェクトが必要になります。

WcfServiceのをテストする場合は、適切なポートを使用するようにテストプロジェクトのapp.configファイルを設定する必要があります。

これは、webservicesの新機能であり、恥ずかしいことではない一般的なエラーです。

0

あなたがWireSharkのようなものを使用してみましたか?両方のエンドポイントで実行すると、ソケットの問題をトラブルシューティングするのに適しています。

関連する問題