【问题标题】:A binding instance has already been associated to listen URI .after moving from .NET 4.0 to 4.5从 .NET 4.0 移动到 4.5 后,绑定实例已经与监听 URI 相关联
【发布时间】:2020-08-06 16:21:00
【问题描述】:

经过 3 天的永无止境的搜索,我发布了这个。请帮忙。以下是我拥有的配置文件。只指定了一个端点,但它说端点存在冲突。请帮我纠正这个冲突。

System.InvalidOperationException:绑定实例已经 关联到监听 URI 'http://dd.myserver.net/MyWebService/MyService'。如果两个端点想要 要共享相同的 ListenUri,它们还必须共享相同的绑定 对象实例。指定了两个冲突的端点 在 AddServiceEndpoint() 调用中、在配置文件中或以下组合中 AddServiceEndpoint() 和配置。

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
    <add key="wcf:webservicehost:enableautomaticendpointscompatability" value="true"/>
  </appSettings>
 
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
    <authentication mode="None"/>
    <customErrors mode="Off"/>
  </system.web>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="ServiceBehavior" name="MyRESTService.MyService">
        <endpoint address="" behaviorConfiguration="web" binding="webHttpBinding" contract="MyRESTService.IMyService" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <webHttpBinding>
        <binding maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"/>
          <security mode="None">
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <protocolMapping>
      <add binding="webHttpBinding" scheme="http"/>
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="false"/>
  </system.webServer>
</configuration>

【问题讨论】:

    标签: wcf binding conflict


    【解决方案1】:

    最后我解决了一个人给出的错误 [https://stackoverflow.com/questions/12643113/wcf-conflicting-endpoints-after-net-4-5-installation/39394010]

    我刚刚去掉了里面的安全标签

    之前

     <webHttpBinding>
            <binding maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647">
              <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"/>
              <security mode="None">
              </security>
            </binding>
          </webHttpBinding>
    

    之后

    <webHttpBinding>
            <binding maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647">
              <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"/>
             </binding>
          </webHttpBinding>
    

    这个小东西花了我 3 天的时间搜索。感谢stackoverflow。

    【讨论】:

      猜你喜欢
      • 2012-11-18
      • 2021-07-09
      • 2012-07-15
      • 2019-12-02
      • 1970-01-01
      • 1970-01-01
      • 2013-09-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多