2

WCF テスト クライアントを実行すると、次のエラーが表示されます。

エラー: localhost:52875/ControllersInfo.svc からメタデータを取得できません これがアクセス権を持つ Windows (R) Communication Foundation サービスである場合は、指定されたアドレスでのメタデータ公開が有効になっていることを確認してください。
メタデータに、解決できない参照が含まれています: localhost:52875/ControllersInfo.svc'。メッセージを受け入れることができる localhost:52875/ControllersInfo.svc でリッスンしているエンドポイントはありませんでした。これは、多くの場合、アドレスまたは SOAP アクションが正しくないことが原因です。詳細については、InnerException (存在する場合) を参照してください。

ここに私のweb.configファイルがあります

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
  </system.web>
  <system.serviceModel>
    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint helpEnabled="true" automaticFormatSelectionEnabled="true" />
      </webHttpEndpoint>
    </standardEndpoints>
    <services>
      <service name="dev_FineReceiptsService.ControllersInfo">
        <endpoint kind="webHttpEndpoint" contract="dev_FineReceiptsService.IControllersInfo" />
      </service>
    </services>
  </system.serviceModel>
  <connectionStrings>
    <add name="FineReceiptsTestEntities" connectionString="metadata=res://*/FineTest.csdl|res://*/FineTest.ssdl|res://*/FineTest.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=msdev01;Initial Catalog=FineReceiptsTest;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

誰が私が間違ったことを教えてもらえますか?

同様の質問を見つけようとしましたが、どれも役に立ちませんでした。

4

2 に答える 2

0

サービスは REST ベースのサービスです ( を指定したためwebHttpBinding)。

ただし、WCF テスト クライアントはSOAP ベースのテスト ツールであり、これを使用してSOAPサービスをテストできます。basicHttpBindingwsHttpBinding

しかし、SOAP ベースの WCF テスト クライアントを使用して REST ベースの WCF サービスをテストすることはできません... それは機能しません通常の Web ブラウザーを使用し、Fiddler などと組み合わせて REST サービスをテストすることもできます。

于 2012-10-05T09:10:15.137 に答える
0

メタデータ エンドポイントは、 SOAPサービスを記述する WSDL + XSD を公開します。REST のメタデータの公開はサポートされていません。webHttpEndpoint を使用しているため、WCFTestClient は使用できません。Rest Service のテストには、RestSharpまたは Browser を使用できます。

簡素化された構成で SOAP サービスにメタデータを追加する必要がある場合は、次の動作を追加する必要があります。

<configuration>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>
于 2012-10-05T09:10:20.933 に答える