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:
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.
Did you add net.tcp as an Enabled Protocol in IIS? Manage website => advanced settings => enabled protocols (comma delimited)
对于遇到同样问题的人:正如我之前说过的,我将应用程序池更改为经典,但它不起作用(http也不再起作用),但是当我将其更改回并回收应用程序池时,它突然起作用了。
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.