简体   繁体   中英

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.

First of all, you should have a Service.svc pointing to the implementation of your service. Then, in the service entry, try specifying the full name (the one that you use in the Service attribute of the Service.svc file) without the assembly, if it is in a separate project. Finally, use the full name of the implemented service contract for the contract attribute (omit assembly here, too). The name of the endpoint shouldn't be important.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM