IIS 7.5 / WCF - net.tcp status unknown

Deadly 提交于 2020-01-05 04:07:05

问题


I'm trying to get my WCF service working with netTcpBinding instead of wsHttpBinding, but I can't seem to get it working.

I added the net.tcp binding to IIS7.5 but the status is Unknown (and when I also remove the http binding it puts a big red X through the site and I have to add a new http binding before I can access any settings again). I already looked here and on Google but I could only find two or three posts about this issue without any true solutions.

What I have:

  • WAS service running, and also the Net.* services.
  • Added net.tcp in Advanced Settings in IIS.
  • WCF non-http is installed.

There seems to be a TCP listener running, as it shows in netstat that it is listening on my specified port: 809) and I also got firewall message (also tried disabling the firewall/antivirus, but it didn't help).

WCF Test Client results in this error:

Error: Cannot obtain Metadata from net.tcp://localhost:809/MyService.svc

My Web.config (as copied mostly from MSDN, for proper layout look here http://pastebin.com/Ru8p0T9N):

<services>
  <service behaviorConfiguration="MyBehavior" name="WCFService.MyService">
    <endpoint address="" binding="netTcpBinding" bindingConfiguration="Binding1" name="MyServiceEndpoint" contract="WCFService.MyService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" name="MyServiceMexTcpBidingEndpoint" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:809/MyService.svc" />
      </baseAddresses>
    </host>
  </service>
</services>
<behavior name="MyBehavior">
  <serviceMetadata httpGetEnabled="false" />
  <serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<netTcpBinding>
  <binding name="Binding1"hostNameComparisonMode="StrongWildcard"sendTimeout="00:10:00"maxReceivedMessageSize="65536"transferMode="Buffered"portSharingEnabled="true">
    <security mode="Message">
      <transport clientCredentialType="None" />
      <message clientCredentialType="None" />
    </security>
  </binding>
</netTcpBinding> 

Everything works fine with wsHttpBinding but not with net.tcp. I tried several different settings in the Web.config from multiple sources but I keep ending up with the same problem.


回答1:


Did you add net.tcp as an Enabled Protocol in IIS? Manage website => advanced settings => enabled protocols (comma delimited)




回答2:


For people having the same problem: As I said before, I changed the Application Pool to Classic and it didn't work (http also didn't work anymore), but when I changed it back and recycled application pool it suddenly worked.



来源:https://stackoverflow.com/questions/10743896/iis-7-5-wcf-net-tcp-status-unknown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!