How to get WSDL for a netTcpBinding WCF
-
Tuesday, April 22, 2008 1:51 PM
Hello,
Can someone pls let me know how to create a WSDL for a WCF service which has netTcpBinding and hosted as a windows service?
Thanks,
Rathi
All Replies
-
Tuesday, April 22, 2008 1:58 PMModerator
You have to create a mexNetTcpBinding endpoint, set the contract on it to IMetadataExchange, and enable "serviceMetadata" in the service behavior. An example of this:
Code Snippet<services>
<service
name="MyService"
behaviorConfiguration="myBehavior">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9000/MyService"/>
</baseAddresses>
</host>
<endpoint
name="netTcp"
address=""
binding="netTcpBinding"
bindingConfiguration="secure"
contract="IIMyService">
</endpoint>
<endpoint
name="mexNetTcp"
address="net.tcp://localhost:9001/CommMgr/mex"
binding="mexTcpBinding"
contract="IMetadataExchange">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="myBehavior">
<serviceMetadata />
</behavior>
</serviceBehaviors>
</behaviors> -
Tuesday, April 22, 2008 3:36 PMSo after adding this end point, can i be able to see the wsdl in this url net.tcp://localhost:9001/CommMgr/mex
?
Thanks,
Rathi
-
Tuesday, April 22, 2008 3:38 PMModerator
Yup. You will need to change the contracts and things to match yours, but this is the jist of it.
-
Tuesday, April 22, 2008 3:51 PM
Hi, below is my configuration.
<
system.serviceModel><
services><
service name="WCFServiceLibrary.service1" behaviorConfiguration="ServiceBehavior"><
host><
baseAddresses><
add baseAddress="net.tcp://localhost:5000/WCFServiceLibrary/service1"/></
baseAddresses></
host><
endpoint address="" binding="netTcpBinding" bindingConfiguration ="secure" contract="WCFServiceLibrary.IService1" /><
endpoint name="mexNetTcp" address="net.tcp://localhost:5001/WCFServiceLibrary/mex" binding="mexTcpBinding" contract="IMetadataExchange"></
endpoint></
service></
services><
behaviors><
serviceBehaviors><
behavior name ="ServiceBehavior"><
serviceDebug includeExceptionDetailInFaults="true"/><
serviceMetadata/></
behavior></
serviceBehaviors></
behaviors></
system.serviceModel>After adding the endpoint for metadata, i am not able to connect to the service at all. Can u let me know what the issue is?
Thanks,
Rathi
-
Tuesday, April 22, 2008 3:53 PMModeratorWell for one you have no binding configuration so remove "bindingConfiguration ="secure""
-
Tuesday, April 22, 2008 3:59 PM
Am getting the below issue now.
There was no endpoint listening at net.tcp://localhost:5000/WCFServiceLibrary/service1 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
And here is the config details:
Host Config:
<
services><
service name="WCFServiceLibrary.service1" behaviorConfiguration="ServiceBehavior"><
host><
baseAddresses><
add baseAddress="net.tcp://localhost:5000/WCFServiceLibrary/service1"/></
baseAddresses></
host><
endpoint address="" binding="netTcpBinding" contract="WCFServiceLibrary.IService1" /><
endpoint name="mexNetTcp" address="net.tcp://localhost:5001/WCFServiceLibrary/mex" binding="mexTcpBinding" contract="IMetadataExchange"></
endpoint></
service></
services><
behaviors><
serviceBehaviors><
behavior name ="ServiceBehavior"><
serviceDebug includeExceptionDetailInFaults="true"/><
serviceMetadata/></
behavior></
serviceBehaviors></
behaviors>and client config:
<
system.serviceModel><
client><
endpoint binding ="netTcpBinding" name ="HBOSTest" address ="net.tcp://localhost:5000/WCFServiceLibrary/service1" contract ="WindowsApplicationTestWCF.IService1"></endpoint></
client></
system.serviceModel> -
Tuesday, April 22, 2008 4:02 PMModeratorThat address is correct. Make sure your sevice is running or maybe run WcfTestClient.exe against that address to make sure it is running.
-
Tuesday, April 22, 2008 4:19 PM
I could not figure out what the issue is, but the windows service is started and running..
it was working fine..
-
Friday, May 02, 2008 12:46 PM
Can someone tell me, i can get the WSDL for a tcp binding service only on .NET 3.5 / VS2008?
Thanks,
rathi
-
Friday, May 02, 2008 12:49 PMModeratorNo this will work in .Net 3.0 and/or VS2005. Once you have the metadata exchange endpoint setup you can navitate to it in the web browser or whatever and see the wsdl being generated.
-
Friday, May 02, 2008 5:21 PM
am getting the issue that the service contract IMetaDataEndpoint is not available in the service name when i tried.Any ideas??
Thanks,
Rathi
-
Friday, May 02, 2008 6:51 PM
hi,
I have got the issue solved. I need to specify a http url in the base address section of the host. Attached the server (host) configuration file.
Thanks,
Rathi
<
configuration><
system.serviceModel><
services><
service name ="WcfServiceLibrary.Service1" behaviorConfiguration ="Sbehavior"><
host><
baseAddresses><
add baseAddress="http://localhost:5002/WcfServiceLibrary/mex"/><
add baseAddress ="net.tcp://localhost:5001/WcfServiceLibrary/Service1"/></
baseAddresses></
host><
endpoint address ="" binding ="netTcpBinding" contract ="WcfServiceLibrary.IService1"></endpoint><
endpoint address ="net.tcp://localhost:5001/WcfServiceLibrary/mex" binding ="mexTcpBinding" contract ="IMetadataExchange"></endpoint></
service></
services><
behaviors><
serviceBehaviors><
behavior name ="Sbehavior"><
serviceDebug includeExceptionDetailInFaults ="true"/><
serviceMetadata httpGetEnabled ="true"/></
behavior></
serviceBehaviors></
behaviors></
system.serviceModel></
configuration> -
Friday, October 14, 2011 7:27 AM
Hi Rathi,
Thanks for such a Nice Blog.
I have one question here, i am getting one error when i tried to host both nettcp address and mexNetTcp address on the same port. R u getting this error?.
And are you able to access the WSDl from "net.tcp://localhost:5001/WcfServiceLibrary/mex" , because i am not.
Please find below my app Config details
<services> <service name="TransactionImplementer" behaviorConfiguration="ServiceBehavior"> <host> <baseAddresses> <add baseAddress="net.tcp://localhost:9001/services/CommonOperations" /> <add baseAddress="http://localhost:8001/services/CommonOperations/mex"/> </baseAddresses> </host> <endpoint address="" binding="netTcpBinding" bindingConfiguration="BasicTCP" behaviorConfiguration="" contract="ITransactionImplementer" name="ITransactionImplementer" > <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="net.tcp://localhost:9002/services/CommonOperations/mex" binding="mexTcpBinding" behaviorConfiguration="" contract="IMetadataExchange" name="IMetadataExchange"/> </service>
Your Quick response will be highly appreciated.

