WCF - Conflicting Endpoints After Installing .Net 4.5

I recently installed the 4.5 framework on our development web server, which runs IIS 7.5 on Windows Server 2008. After installation, the two web services started to have the same error. These web services were created using the MS REST starter kit. Here is the error I am getting.

The binding instance is already associated with a listening URI. If two endpoints want to use the same ListenUri, they must also use the same instance of the binding object. Two conflicting endpoints were either specified in the AddServiceEndpoint () calls, or in the configuration file, or in combination with AddServiceEndpoint () and configuration.

Here is a copy of the system.service model section of our configuration 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> 

Any idea why this error occurred after installing .Net 4.5?

I would like to add that I tried to delete this section, and it works without it.

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

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

+4
source share
2 answers

I am from the WCF team. Thanks for reporting this issue. The WCF team will continue to investigate this issue to fix it. While we are exploring, you can get around this by explicitly configuring the webHttp endpoint in your configuration file. The service will be the same as before. Try these simple steps.

(I take the configuration file that you posted in this post as a starting point)

  • Comment on <standardEndpoints> in your configuration file:

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

    </webHttpEndpoint>
    </standardEndpoints> β†’

  • Add this endpoint behavior to your list as follows:

    <behavior>
    <endpointBehaviors>
    <behavior name = "REST"> <webHttp helpEnabled = "true" automaticFormatSelectionEnabled = "true" />

    </ behavior>
    <& / endpointBehaviors GT;
    <& / behavior of GT;

  • Explicitly configure the service endpoint in the configuration file as follows. For the highlighted attribute values, replace your service type name and contract name accordingly (Note: if you do not have a contract defined for the service, then enter the service type name in contract = "" too)

    <services>
    <service name = "WcfRestService1.Service1">
    <<endpoint address = "binding =" webHttpBinding "contract =" WcfRestService1.Service1 "behaviorConfiguration =" REST "/>

    </ services>
    <& / services GT;

+1
source

In my case, the problem was resolved after removing the <security/> from web.config. I set it to "none", so this may not apply to your specific case.

0
source

Source: https://habr.com/ru/post/1436845/


All Articles