简体   繁体   中英

WCF - unable to stop net.tcp binding (hosted on IIS)

I have working WCF service on IIS with configured net.tcp endpoint. After disable page on IIS I'm still able to run request to my service oO . Disabling application pool works as expected (service is no longer available).

<system.serviceModel>
    <services>
      <service name="xyz.Service.Authentication.Implementation.AuthenticationService">
        <endpoint binding="netTcpBinding"
                  bindingConfiguration="NetTcpBinding"
                  contract="xyz.Service.Authentication.Model.IAuthenticationService"/>
      </service>
    </services>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBinding" sendTimeout="00:00:30" 
                 transactionFlow="false" 
                 portSharingEnabled="false"
                 maxReceivedMessageSize="18000">
          <security mode="Transport">
            <transport clientCredentialType="Windows" protectionLevel="Sign"/>
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceAuthorization principalPermissionMode="UseWindowsGroups"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

Is it a bug or a feature ?

I had similar problem and I found out that:

  • Stopping Web Site does not stop the net.tcp service
  • Disable App Pool disables service but does not free the port, port is still used by SMSvcHost.exe
  • Restarting after does not helps too.

The only way to free port ( to be used by something else ) was to delete net.tcp binding in IIS.

I spent time on this, because received wrong answers from net.tcp service. It took me while, to find out - it's not from my service, but from old disabled one. This could save time to someone else.

删除net.tcp绑定

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