2011-11-08 29 views
1

現在、サービス契約&の実装を含むwcfサービスライブラリプロジェクトがあります。私が同じソリューション内のWebプロジェクトに行き、サービス参照を追加して「発見」ボタンをクリックすると、http://..design_time_address/myserviceと表示されたサービスが表示されます。私は先に行くと、別のプロジェクトに私のサービス契約&実装クラスを移動&この新しいプロジェクトを指すように私のWCFライブラリプロジェクトを設定した場合WCF design_time_addressがVisual Studio 2010内に表示されない

は今、私は私が行くときことを見つけて、内のサービスを発見しようとしています私のWebアプリケーションでは、もうdesign_time_addressが表示されません。それは何かを発見していない...

ここ

は、WCFサービスのための私の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="Test.Server.Wcf.Service1"> 
     <host> 
      <baseAddresses> 
      <add baseAddress = "http://localhost:8732/Design_Time_Addresses/Test.Server.Wcf/Service1/" /> 
      </baseAddresses> 
     </host> 
     <!-- Service Endpoints --> 
     <!-- Unless fully qualified, address is relative to base address supplied above --> 
     <endpoint address ="" binding="wsHttpBinding" contract="Test.Server.Wcf.IService1"> 
      <!-- 
       Upon deployment, the following identity element should be removed or replaced to reflect the 
       identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
       automatically. 
      --> 
      <identity> 
      <dns value="localhost"/> 
      </identity> 
     </endpoint> 
     <!-- Metadata Endpoints --> 
     <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
     <!-- This endpoint does not use a secure binding and should be secured or removed before deployment --> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </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> 

とにクラスを移動する前のように見えたものだ、それが移動した後、次のようになります

<?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="Test.Server.Core.Service1"> 
     <host> 
      <baseAddresses> 
      <add baseAddress = "http://localhost:8732/Design_Time_Addresses/Test.Server.Wcf/Service1/" /> 
      </baseAddresses> 
     </host> 
     <!-- Service Endpoints --> 
     <!-- Unless fully qualified, address is relative to base address supplied above --> 
     <endpoint address ="" binding="wsHttpBinding" contract="Test.Server.Core.IService1"> 
      <!-- 
       Upon deployment, the following identity element should be removed or replaced to reflect the 
       identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
       automatically. 
      --> 
      <identity> 
      <dns value="localhost"/> 
      </identity> 
     </endpoint> 
     <!-- Metadata Endpoints --> 
     <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
     <!-- This endpoint does not use a secure binding and should be secured or removed before deployment --> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </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> 

私は間違って何をしていますか?どんな助けでも大歓迎です。私は今、時間、この上で立ち往生してきたと私は私が私の心を失ってるように感じる...あなたは、サービス参照を追加するために使用

おかげ

+0

「移動」と言うとき、ファイルはすべてあなたがしたものですか?あなたは "既存のプロジェクトを追加..."を追加する必要があります –

+0

はい、私は構成の意味だった。申し訳ありませんが、私はそれをより明確に指定すべきでした。 – zSynopsis

答えて

1

出会うオプションは、内部のVisual Studioの機能です。実際に実装を見つけることができるWCFサービスを開始して一覧表示します。何らかの理由で、WCFプロジェクトタイプ(ライブラリまたはアプリケーション)でサービスインタフェースの実装をコンフィグレーションファイルで検索する必要があります。したがって、実装をコアプロジェクトに移動してapp.configファイルのない通常のクラスライブラリにすると、が見つかりませんでした。サービスが終了しました。

可能なことは、サービスを手動で開始し、ブラウザをURLに追加してサービス参照を追加することです。それはもはや動作しない検出オプションです。

+0

Visual Studioで手動でサービスを開始するにはどうすればよいですか?私は、プロジェクトをスタートアッププロジェクトとして設定し、デバッグ開始ボタンを押してみましたが、「ターゲットアセンブリにはサービスタイプが含まれていません。このアセンブリのコードアクセスセキュリティポリシーを調整する必要があり、実行を停止します。ご協力いただきありがとうございます! – zSynopsis

+0

ああ、それはキャッチです:-)私は通常、サービス上でデバッグセッションを開始し、元のインスタンスを使用してサービス参照を作成するために2番目のVisual Studioを開始します。 WCFサービスがIISに展開されている場合(WCFアプリケーションのような)、サービスを公開してそのURLを参照するだけで(設計時アドレスを変更する必要があります)。 – kroonwijk

関連する問題