0

我有一个运行良好的 WCF 服务,我最近尝试添加代码以包含上传文件片段,从那时起我一直收到以下错误:绑定实例已关联到侦听 URI 'http://xxx /DSLDService/DSLDService.svc'。如果两个端点想要共享同一个 ListenUri,它们也必须共享同一个绑定对象实例。两个冲突的端点要么在 AddServiceEndpoint() 调用中指定,要么在配置文件中指定,要么在 AddServiceEndpoint() 和 config 的组合中指定。

我不确定出了什么问题,如果我从我的配置文件中删除了我为服务的 FileUpload 部分包含的条目,那么该站点可以工作,但上传的部分不会。以下是我的服务和客户端配置,有人可以查看它们并让我知道他们是否看到了什么:

客户端 Web.config:

  <system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IRequestType" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="20000000"
      maxReceivedMessageSize="20000000" useDefaultWebProxy="true" />
    <binding name="BasicHttpBinding_IRecipientType" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="20000000"
      maxReceivedMessageSize="20000000" useDefaultWebProxy="true" />
    <binding name="BasicHttpBinding_ICase" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="20000000"
      maxReceivedMessageSize="20000000" useDefaultWebProxy="true" />
    <binding name="BasicHttpBinding_IHoliday" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="20000000"
      maxReceivedMessageSize="20000000" useDefaultWebProxy="true" />
    <binding name="BasicHttpBinding_IManagerType" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="20000000"
      maxReceivedMessageSize="20000000" useDefaultWebProxy="true" />
    <binding name="BasicHttpBinding_IDonor" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="20000000"
      maxReceivedMessageSize="20000000" useDefaultWebProxy="true" />
    <binding name="BasicHttpBinding_IUser" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="20000000"
      maxReceivedMessageSize="20000000" useDefaultWebProxy="true" />
    <binding name="BasicHttpBinding_ICaseStatus" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="20000000"
      maxReceivedMessageSize="20000000" useDefaultWebProxy="true" />
    <binding name="BasicHttpBinding_ICaseDonor" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="20000000"
      maxReceivedMessageSize="20000000" useDefaultWebProxy="true" />
    <binding name="BasicHttpBinding_IAbsence" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="20000000"
      maxReceivedMessageSize="20000000" useDefaultWebProxy="true" />
    <binding name="BasicHttpBinding_IAgency" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="20000000"
      maxReceivedMessageSize="20000000" useDefaultWebProxy="true" />
    <binding name="BasicHttpBinding_IDocument" closeTimeout="04:01:00"
      openTimeout="04:01:00" receiveTimeout="04:01:00" sendTimeout="04:01:00"
      maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
      transferMode="Streamed">
      <readerQuotas maxDepth="128" maxStringContentLength="2147483647"
      maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://xxx/DSLDService/DSLDService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IRequestType"
    contract="DSLDServiceReference.IRequestType" name="" />
  <endpoint address="http://xxx/DSLDService/DSLDService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IRecipientType"
    contract="DSLDServiceReference.IRecipientType" name="" />
  <endpoint address="http://xxx/DSLDService/DSLDService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICase"
    contract="DSLDServiceReference.ICase" name="" />
  <endpoint address="http://xxx/DSLDService/DSLDService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IHoliday"
    contract="DSLDServiceReference.IHoliday" name="" />
  <endpoint address="http://xxx/DSLDService/DSLDService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IManagerType"
    contract="DSLDServiceReference.IManagerType" name="" />
  <endpoint address="http://xxx/DSLDService/DSLDService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDonor"
    contract="DSLDServiceReference.IDonor" name="" />
  <endpoint address="http://xxx/DSLDService/DSLDService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUser"
    contract="DSLDServiceReference.IUser" name="" />
  <endpoint address="http://xxx/DSLDService/DSLDService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICaseStatus"
    contract="DSLDServiceReference.ICaseStatus" name="" />
  <endpoint address="http://xxx/DSLDService/DSLDService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICaseDonor"
    contract="DSLDServiceReference.ICaseDonor" name="" />
  <endpoint address="http://xxx/DSLDService/DSLDService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAbsence"
    contract="DSLDServiceReference.IAbsence" name="" />
  <endpoint address="http://xxx/DSLDService/DSLDService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAgency"
    contract="DSLDServiceReference.IAgency" name="" />
  <endpoint address="http://xxx/DSLDService/DSLDService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDocument"
    contract="DSLDServiceReference.IDocument" name="" />
</client>

wcf 服务 web.config 看起来像:

<bindings>
  <basicHttpBinding>
    <!-- set to 2GB files (Maximum allowed per MSDN Documentation) -->
    <binding name="TransferService"
    maxReceivedMessageSize="2147483647"
    maxBufferSize="2147483647" transferMode="Streamed">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
      maxArrayLength="2147483647" maxBytesPerRead="2147483647"
      maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>      
</bindings>
<services>
  <service name="DSLDService.DSLDService">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
      contract="DSLDService.IRequestType" />
    <endpoint binding="basicHttpBinding" bindingConfiguration=""
      contract="DSLDService.IRecipientType" />
    <endpoint binding="basicHttpBinding" bindingConfiguration=""
      contract="DSLDService.ICase" />
    <endpoint binding="basicHttpBinding" bindingConfiguration=""
      contract="DSLDService.IHoliday" />
    <endpoint binding="basicHttpBinding" bindingConfiguration=""
      contract="DSLDService.IManagerType" />
    <endpoint binding="basicHttpBinding" bindingConfiguration=""
      contract="DSLDService.IDonor" />
    <endpoint binding="basicHttpBinding" bindingConfiguration=""
      contract="DSLDService.IUser" />
    <endpoint binding="basicHttpBinding" bindingConfiguration=""
      contract="DSLDService.ICaseStatus" />
    <endpoint binding="basicHttpBinding" bindingConfiguration=""
      contract="DSLDService.ICaseDonor" />
    <endpoint binding="basicHttpBinding" bindingConfiguration=""
      contract="DSLDService.IAbsence" />
    <endpoint binding="basicHttpBinding" bindingConfiguration=""
      contract="DSLDService.IAgency" />
    <endpoint binding="basicHttpBinding" bindingConfiguration="TransferService" 
      contract="DSLDService.IDocument" />
  </service>
</services>

问题似乎与 IDocument 类条目有关,其他工作正常。所有都是 BasicHTTPBinding 所以我想我可以把它们留在同一个服务中,不知道为什么它告诉我一个绑定已经关联。

谢谢你。

4

1 回答 1

0

为什么需要所有这些端点和绑定。我认为应该有 1 个端点和 1 个绑定。我以前从未见过这种配置。

于 2012-11-30T17:47:28.650 回答