WCF - .Net 4.5 安装后端点冲突 [英] WCF - Conflicting endpoints after .Net 4.5 installation

查看:22
本文介绍了WCF - .Net 4.5 安装后端点冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在我们的开发 Web 服务器上安装了 4.5 框架,该服务器在 Windows Server 2008 上运行 IIS 7.5.安装后,两个 Web 服务开始出现相同的错误.这些 Web 服务是使用 MS REST Starter Kit 构建的.这是我遇到的错误.

I'm recently installed the 4.5 framework on our development web server which runs IIS 7.5 on Windows Server 2008. After installation, two web services started having the same error. These web services were built using the MS REST Starter Kit. Here is the error I'm getting.

一个绑定实例已经与侦听 URI 相关联.如果两个端点想要共享同一个 ListenUri,它们也必须共享同一个绑定对象实例.两个冲突的端点要么在 AddServiceEndpoint() 调用中指定,要么在配置文件中指定,要么在 AddServiceEndpoint() 和配置的组合中指定.

这是我们配置文件的 system.service 模型部分的副本.

Here is a copy of the system.service model section of our config file.

<system.serviceModel>
   <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />  
    <bindings>
      <webHttpBinding>
        <binding>
          <security mode="Transport" />
        </binding>
      </webHttpBinding>
      <wsHttpBinding>
        <binding name="EnterpriseIdentityBinding" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
          textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
            enabled="false" />
          <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" negotiateServiceCredential="true"
              algorithmSuite="Default" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>

    <client>
      <endpoint address="https://betaapps/EnterpriseIdentity/V1/UserService.svc"
        binding="wsHttpBinding" bindingConfiguration="EnterpriseIdentityBinding"
        contract="UserServiceWCF.IUserService" name="wsSecureUsers" />
      <endpoint address="https://betaapps/EnterpriseIdentity/V1/RoleService.svc"
        binding="wsHttpBinding" bindingConfiguration="EnterpriseIdentityBinding"
        contract="RoleServiceWCF.IRoleService" name="wsSecureRoles" />
    </client>

    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
      </webHttpEndpoint>
    </standardEndpoints>

    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceAuthorization principalPermissionMode="Custom">
            <authorizationPolicies>
              <add policyType="Hsmv.Web.Security.IdentityModel.HttpContextWithRolesPolicy, Hsmv.Web.Security" />
            </authorizationPolicies>
          </serviceAuthorization>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

知道为什么在安装 .Net 4.5 后会出现这个错误吗?

Any idea why this error would occur after installing .Net 4.5?

我想补充一点,我尝试删除此部分,没有它也能正常工作.

I would like to add that I tried removing this section and it does work without it.

<webHttpBinding>
        <binding>
          <security mode="Transport" />
        </binding>
</webHttpBinding>

我使用它是因为此服务在 ssl 上运行.我听说 WCF 4.5 尝试为您创建绑定和端点,因此它们不需要在 web.config 中.所以我想知道这个部分是不是由WCF自动构建的,不需要.还是我的想法不正确?谢谢!

I use this because this service runs on ssl. I heard that WCF 4.5 tries to create bindings and endpoints for you so they don't need to be in the web.config. So I wondered if this section is being automatically built by WCF and is not needed. Or is my thinking incorrect? Thanks!

推荐答案

我来自 WCF 团队.感谢您报告此问题.WCF 团队将继续调查此问题以进行修复.在我们调查期间,您可以通过在配置文件中显式配置 webHttp 端点来解决此问题.服务将与以前的行为相同.尝试遵循这些简单的步骤.

I am from WCF team. Thanks for reporting this issue. WCF team will continue to investigate this issue for fix. While we investigate you can work around this by explicitly configuring a webHttp endpoint in your configuration file. Service will be the same by behavior like before. Try to follow these simple steps.

(我以你在这篇文章中发布的配置文件为起点)

(I am taking the configuration file that you have published in this post as a starting point)

  1. 注释掉<standardEndpoints>配置文件中的标签:

  1. Comment out the <standardEndpoints> tag in your configuration file: