我有一个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,所以我想我可以把它们留在同一个服务中,不知道为什么它告诉我绑定已经关联。
谢谢。
答案 0 :(得分:0)
为什么需要所有这些端点和绑定。在我看来应该有1个端点和1个绑定。我以前从未见过这种配置。