Search code examples
wcfiisduplex

Hosting wcf duplex service in IIS


I'm able to host a "normal" basichttp service with IIS and access it over the local network. The problem is, that I'm trying to do a duplex service and host it in IIS.

My Web.Config:

<system.serviceModel>
<services>
  <service behaviorConfiguration="BaseBehavior" name="RegistrationService">
    <endpoint binding="wsDualHttpBinding" bindingConfiguration="wsDualHttpBind" name="RegistrationService" contract="Service" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="BaseBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <wsDualHttpBinding>
    <binding name="wsDualHttpBind" sendTimeout="00:01:00">
      <security mode="None">
        <message clientCredentialType="None" />
      </security>
    </binding>
  </wsDualHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

The error message i get when i open "http://localhost /Service/Service.svc" :

"The contract requires "duplex" binding "BasicHttpBinding 'does not support this, and the support was not configured correctly."

I googled and found different settings for the web.config but none worked. My guess is, that the web.config is wrong.


Solution

  • Thank you for your fast answer fra. My config was completely wrong ^^

    After reading this article:

    http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,b891610a-6b78-4b54-b9a6-4ec81c82b7c0.aspx

    i changed from wsDualHttpBinding to net.tcp.

    My new web.config looks like this:

    <system.serviceModel>
    
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyBehaviour">
          <serviceMetadata />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
    <service name="Service" behaviorConfiguration="MyBehaviour">
      <endpoint address=""
                binding="netTcpBinding"
                bindingConfiguration="InsecureTcp"
                contract="IService" />
      <endpoint address="mextcp" binding="mexTcpBinding" contract="IMetadataExchange"/>
    </service>
    </services>
    <bindings>
      <netTcpBinding>
        <binding name="InsecureTcp" portSharingEnabled="true">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
    

    And in IIS i added net.tcp to the website. (http,net.tpc) And the firewall has to allow the ports.

    Now it's working.