gpt4 book ai didi

WCF - .Net 4.5 安装后的端点冲突

转载 作者:行者123 更新时间:2023-12-04 23:27:16 24 4
gpt4 key购买 nike

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

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

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

<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 后会出现此错误吗?

我想补充一点,我尝试删除此部分,没有它它确实可以工作。
<webHttpBinding>
<binding>
<security mode="Transport" />
</binding>
</webHttpBinding>

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

最佳答案

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

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

  • 注释掉配置文件中的 标记:

  • 将此端点行为添加到您的列表中,如下所示:

    <行为>
    <端点行为>
    <行为名称="REST">



  • 像这样在配置文件中显式配置您的服务端点。对于突出显示的属性值,分别替换您的服务类型名称和契约(Contract)名称(注意:如果您没有为服务定义契约(Contract),则在契约(Contract) =“”中插入服务类型名称)

    <服务>
    <服务名称="WcfRestService1.Service1">


  • 关于WCF - .Net 4.5 安装后的端点冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12643113/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com