0

WCF サービス クライアント オブジェクトの作成中に問題が発生しました。

HelloServiceClient helloWorldClient = new HelloServiceClient("BasicHttpBinding_IDataAccess");

これが私の ServiceReferences.ClientConfig の内容です

<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IDataAccess" maxBufferSize="2147483647"
            maxReceivedMessageSize="2147483647">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:8732/Design_Time_Addresses/HelloWcf/Service1/mex" binding="basicHttpBinding"
          bindingConfiguration="BasicHttpBinding_IDataAccess" contract="IHelloService"
          name="BasicHttpBinding_IDataAccess" />
    </client>
  </system.serviceModel>
</configuration>

エラーメッセージは次のとおりです

System.InvalidOperationException: ServiceModel クライアント構成セクションで、名前が 'BasicHttpBinding_IDataAccess' でコントラクトが 'ServiceReference1.IHelloService' のエンドポイント要素が見つかりませんでした。これは、アプリケーションの構成ファイルが見つからなかったか、この名前に一致するエンドポイント要素が client 要素に見つからなかったためである可能性があります。System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors (ServiceEndpoint サービス エンドポイント、文字列 configurationName) で System.ServiceModel.ChannelFactory.ApplyConfiguration (文字列 configurationName) で System.ServiceModel.ChannelFactory.InitializeEndpoint (文字列 configurationName、EndpointAddress アドレス) で System.ServiceModel.ChannelFactory 1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress) at System.ServiceModel.EndpointTrait1.System.ServiceModel での CreateSimplexFactory()。1.CreateChannelFactory() at System.ServiceModel.ClientBase1.CreateChannelFactoryRef (EndpointTrait 1 endpointTrait) at System.ServiceModel.ClientBase1.InitializeChannelFactoryRef() at System.ServiceModel.ClientBase`1..ctor(String endpointConfigurationName) at SilverlightApplication1.ServiceReference1.HelloServiceClient..ctor(String endpointConfigurationName) at SilverlightApplication1.MainPage.Button_Click(Object sender, RoutedEventArgs e )

誰かがこの問題について私を助けてくれますか? 他のコード/構成が必要な場合はお知らせください。

4

1 に答える 1

0

上記のように、エラーに示されているように、コントラクト名は「ServiceReference1.IHelloService」である必要があります。

于 2012-09-26T08:26:57.020 に答える