Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't Access Net TCP service From WCF Test Client
    primarykey
    data
    text
    <p>I'm trying to run two WCF services from within IIS one is a web service and one is a Net TCP Binding Service.</p> <p>Here is a simulcrum of my Web.config (I've anonymized the service name):</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;compilation debug="true" targetFramework="4.0" /&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="ServerService"&gt; &lt;endpoint address="ServerService" binding="netTcpBinding" bindingConfiguration="" name="NetTcpEndPoint" contract="IServerService"&gt; &lt;identity&gt; &lt;dns value="localhost" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="net.tcp://localhost:8523/"/&gt; &lt;add baseAddress="htt://localhost:8523/"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;/service&gt; &lt;service name="MyWebService"&gt; &lt;endpoint address="" binding="wsHttpBinding" bindingConfiguration="" name="AACCWSEndPoint" contract="IMyWebService"&gt; &lt;identity&gt; &lt;dns value="localhost" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:8523/IMyWebService"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior&gt; &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt; &lt;serviceMetadata httpGetEnabled="true"/&gt; &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --&gt; &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt; &lt;/system.serviceModel&gt; &lt;system.webServer&gt; &lt;modules runAllManagedModulesForAllRequests="true"/&gt; &lt;/system.webServer&gt; &lt;/configuration&gt; </code></pre> <p>When I run this in the IDE it opens a page running on port 51953 and I can get the WSDL for the webservice by browsing to <a href="http://localhost:51953/WebService.svc?wsdl" rel="nofollow">http://localhost:51953/WebService.svc?wsdl</a> (Note the port is different). I can't seem to get the WSDL by changing to port to what I've specified in the webconfig file (8523).</p> <p>When I point the WcfTestClient app at "net.tcp://localhost:8523/ServerService and it gives me an error saying that it can't access the meta data, which as far as I can see I've configured (the second end point in the service).</p> <p>What am I doing wrong here?</p> <p><strong>UPDATE:</strong></p> <p>I've tried changing the port number on the project properties to 8523 as suggested that didn't seem to work, I've also tried changint the address of the mex endpoint to "ServerService\mex" the test client spent some time churning but then it threw the following error:</p> <blockquote> <p>Error: Cannot obtain Metadata from net.tcp://localhost:8523/ServerService If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at <a href="http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata" rel="nofollow">http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata</a> Exchange Error URI: net.tcp://localhost:8523/ServerService Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8523/ServerService'. You have tried to create a channel to a service that does not support .Net Framing. It is possible that you are encountering an HTTP endpoint. Expected record type 'PreambleAck', found '72'.</p> </blockquote> <p>I'm going to keep digging but I'd appreciate any help.</p> <p><strong>UPDATE 2:</strong></p> <p>I've changed the mex endpoint to a mexTcpBinding: Here is the service tag: </p> <pre><code> &lt;endpoint address="ServerServiceWS" binding="wsHttpBinding" bindingConfiguration="" name="WSEndPoint" contract="IServerService"&gt; &lt;identity&gt; &lt;dns value="localhost" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" /&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="net.tcp://localhost:8523/"/&gt; &lt;add baseAddress="http://localhost:8523/"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;/service&gt; </code></pre> <p>Still no luck. Just to be sure I am entering the correct url into the tester the Url I am using is:</p> <pre><code>net.tcp://localhost:8523/ServerService </code></pre> <p>I've also Tried:</p> <pre><code>net.tcp://localhost:8523/mex </code></pre> <p>and </p> <pre><code>net.tcp://localhost:8523/ </code></pre> <p>All of which give me some variation of the following error:</p> <blockquote> <p>Error: Cannot obtain Metadata from net.tcp://localhost:8523/ServerService If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at <a href="http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata" rel="nofollow">http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata</a> Exchange Error URI: net.tcp://localhost:8523/ServerService Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8523/ServerService'. You have tried to create a channel to a service that does not support .Net Framing. It is possible that you are encountering an HTTP endpoint. Expected record type 'PreambleAck', found '72'.</p> </blockquote> <p><strong>UPDATE 3</strong></p> <p>FWIW I think there might be a bigger problem with my WEb.config Here is what it currently looks like:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;compilation debug="true" targetFramework="4.0" /&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="ServerService"&gt; &lt;endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultBindingConfig" name="NetTcpEndPoint" contract="IServerService"&gt; &lt;identity&gt; &lt;dns value="localhost" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" bindingConfiguration="mexBinding"/&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="net.tcp://localhost:8523/"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;/service&gt; &lt;service name="MyWebService"&gt; &lt;endpoint address="" binding="wsHttpBinding" bindingConfiguration="" name="MyWSEndPoint" contract="IMyWebService"&gt; &lt;identity&gt; &lt;dns value="localhost" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" bindingConfiguration="mexHttpBinding"/&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:8523/MyWebService"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;/service&gt; &lt;/services&gt; &lt;bindings&gt; &lt;netTcpBinding&gt; &lt;binding name="DefaultBindingConfig" maxConnections="5" portSharingEnabled="true" &gt; &lt;/binding&gt; &lt;binding name="mexBinding" portSharingEnabled="true"&gt; &lt;security mode="None"&gt;&lt;/security&gt; &lt;/binding&gt; &lt;/netTcpBinding&gt; &lt;mexTcpBinding&gt; &lt;binding name="mexTcpBinding"/&gt; &lt;/mexTcpBinding&gt; &lt;mexHttpBinding&gt; &lt;binding name="mexHttpBinding"/&gt; &lt;/mexHttpBinding&gt; &lt;/bindings&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="ServerServiceBehaviour"&gt; &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --&gt; &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt; &lt;/behavior&gt; &lt;behavior name="MexBehaviour"&gt; &lt;serviceMetadata httpGetEnabled="true" policyVersion="Policy15"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt; &lt;/system.serviceModel&gt; &lt;system.webServer&gt; &lt;modules runAllManagedModulesForAllRequests="true"/&gt; &lt;/system.webServer&gt; &lt;/configuration&gt; </code></pre> <p>I can browse to the Webservice and that allows me to get the WSDL using ?wsdl but if I put the Adddress <a href="http://localhost:8523/MyWebService" rel="nofollow">http://localhost:8523/MyWebService</a> into the WCF tester it throws an error too.</p> <blockquote> <p>Error: Cannot obtain Metadata from <a href="http://localhost:8523/MyWebService" rel="nofollow">http://localhost:8523/MyWebService</a> If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at <a href="http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata" rel="nofollow">http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata</a> Exchange Error URI: <a href="http://localhost:8523/MyWebService" rel="nofollow">http://localhost:8523/MyWebService</a> Metadata contains a reference that cannot be resolved: 'http://localhost:8523/MyWebService'. An error occurred while receiving the HTTP response to <a href="http://localhost:8523/MyWebService" rel="nofollow">http://localhost:8523/MyWebService</a>. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. The underlying connection was closed: An unexpected error occurred on a receive. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. An existing connection was forcibly closed by the remote hostHTTP GET Error URI: <a href="http://localhost:8523/MyWebService" rel="nofollow">http://localhost:8523/MyWebService</a> There was an error downloading 'http://localhost:8523/MyWebService'. The request failed with HTTP status 404: Not Found.</p> </blockquote> <p>I think the issue is either something to do with paths or I'm just putting the wrong URL into the test application. Either that or I've still not configured the meta data correctly.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload