1

従来の ASP から WCF サービスのメソッドを呼び出す際に問題が発生しています。以下は、サービスと構成のコードです。

サービス

[ServiceContract(Namespace = "http://Plumtree.dartKW.PdfGenerator.Web")]
public interface IPdfGeneratorService
{
    [OperationContract]
    String GeneratePdf(String xml);
}

public class PdfGeneratorService : IPdfGeneratorService
{
    #region IPdfGeneratorService Members

    public String GeneratePdf(String xml)
    {
        return "hello";
    }

    #endregion
}

構成

<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding name="BasicHttpBinding_PdfGenerator"
               maxBufferSize="2147483647"
               maxReceivedMessageSize="2147483647"
               maxBufferPoolSize="2147483647"
               transferMode="Buffered">
        <readerQuotas
          maxArrayLength="2147483647"
          maxStringContentLength="2147483647"
          maxBytesPerRead="2147483647"
          maxNameTableCharCount="2147483647"
          maxDepth="32" />
      </binding>
    </basicHttpBinding>
  </bindings>
  <services>
    <service behaviorConfiguration="serviceBehavior"
             name="Plumtree.dartKW.PdfGenerator.Web.PdfGeneratorService">
      <endpoint binding="basicHttpBinding"
                bindingName="BasicHttpBinding_PdfGenerator"
                contract="Plumtree.dartKW.PdfGenerator.Web.IPdfGeneratorService" />
      <endpoint address="mex"
                binding="mexHttpBinding"
                contract="IMetadataExchange" />
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="serviceBehavior">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

上記の方法を WCF テスト クライアントでテストしたところ、正常に動作しました。私のaspページのコードは次のとおりです。

mexMonikerString = "service:mexAddress='http://localhost:51997/PdfGeneratorService.svc/mex'"
mexMonikerString = mexMonikerString + ", address='http://localhost:51997/PdfGeneratorService.svc'"
mexMonikerString = mexMonikerString + ", binding=basicHttpBinding"
mexMonikerString = mexMonikerString + ", bindingNamespace='http://tempuri.org/'"
mexMonikerString = mexMonikerString + ", contract=IPdfGeneratorService"
mexMonikerString = mexMonikerString + ", contractNamespace='http://Plumtree.dartKW.PdfGenerator.Web'"

dim service
service = GetObject(mexMonikerString) 

これを試すたびに、次のエラーが表示されます。

System.ServiceModel エラー '800401e4'

コントラクトには、指定されたバインディングをサポートするエンドポイントがありません。

BasicHttpBinding_PdfGenerator代わりにモニカーでバインド構成名を渡そうとしましたbasicHttpBindingが、同じエラーが発生します。このエラーの他の例もオンラインで見つけることができません。

どんな助けでも大歓迎です

4

1 に答える 1