你如何在WCF中使用端点

时间:2011-12-13 13:32:09

标签: wcf endpoint

我的服务ScheduleImage.svc位于我网站的根目录中。

如果我浏览http://localhost:1539/ScheduleImage.svc,我可以看到服务和wsdl链接。

我在asp.net项目中添加了服务引用

我可以使用该服务但它使用一些默认端点。 web.config看起来像是:

 <system.serviceModel>
    <!--
    <services>
       <service behaviorConfiguration="MyServiceTypeBehaviors" 
                name="PanoNestWebsite.ScheduleImageprocessing">
           <endpoint 
               address="mex" 
               binding="mexHttpBinding" 
               contract="IMetadataExchange" />
           <endpoint name="SchelduleImageEndpoint"
               address="http://localhost:1539/ScheduleImageProcessing.xamlx"
               binding="basicHttpBinding" 
               bindingConfiguration="BasicHttpBinding_LargeXml"
               contract="PanoNestWebsite.IScheduleService"  />
       </service>
   </services>
   -->
   <bindings>
      <basicHttpBinding>
         <binding name="BasicHttpBinding_LargeXml" 
             closeTimeout="00:10:00" openTimeout="00:10:00" 
             receiveTimeout="01:00:00" sendTimeout="01:00:00"
             allowCookies="false" bypassProxyOnLocal="false"  
             hostNameComparisonMode="StrongWildcard"
             maxBufferSize="655360" maxBufferPoolSize="524288" 
             maxReceivedMessageSize="655360" 
             messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
             useDefaultWebProxy="true">
            <readerQuotas maxDepth="32" maxStringContentLength="8192000"
                          maxArrayLength="900000000" maxBytesPerRead="4096"  
                          maxNameTableCharCount="500000000" />
            <security mode="None">
                  <transport clientCredentialType="None" proxyCredentialType="None"
                             realm="" />
                  <message clientCredentialType="UserName" algorithmSuite="Default" />
            </security>
        </binding>
     </basicHttpBinding>
  </bindings>
  <client>
      <endpoint name="BasicHttpBinding_IService2"
          address="http://localhost:1539/ScheduleImageProcessing.xamlx"
          binding="basicHttpBinding" 
          bindingConfiguration="BasicHttpBinding_LargeXml"
          contract="LocalProcessing.IService"  />
  </client>
  <behaviors>
    <serviceBehaviors>
      <behavior name="myBasicBehaviour">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
      <behavior name="MyServiceTypeBehaviors">
        <serviceMetadata httpGetEnabled="true" />
      </behavior>
      <behavior name="">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

正如您所看到的,我评论了<services>应该定义服务器端点的地方,并且没有区别。我要做的是配置basicHttpBinding以使用配置BasicHttpBinding_LargeXml。我需要这个,因为我想将图像(&lt; = 20MB)作为byte[]发送到服务器。

我可以在客户端添加端点并将其配置为使用BasicHttpBinding_LargeXml绑定配置,但我不知道如何告诉服务使用该绑定。

0 个答案:

没有答案