Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You need to do: </p> <ol> <li>maxHttpBinding -> mexTcpBinding - you cannot use mexHttpBinding on net.tcp endpoint (and it's mex not max)</li> <li>the contract for mex endpoint must be IMetadataExchange - as you want to have service metadata available through this endpoint</li> <li>httpGetEnabled="false" as there will be no http endpoint to get metadata from</li> <li>When I was testing the solution in a simple console host I needed to change name in &lt;service&gt; tag to Externals.ExecutionService (but this depends on how you instantiate the service)</li> </ol> <p>Then your service reference will be available at: <code>net.tcp://localhost:3040/ExecutionService/mex</code> as base address is <code>net.tcp://localhost:3040/ExecutionService</code> and the relative address for the mex endpoint is set to <code>mex</code></p> <p>Final app.config is below:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="Externals.ExecutionService" behaviorConfiguration="Default"&gt; &lt;endpoint name="TCPEndpoint" address="" binding ="netTcpBinding" contract="Externals.IExecutionService"/&gt; &lt;endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="net.tcp://localhost:3040/ExecutionService"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="Default"&gt; &lt;serviceMetadata httpGetEnabled="false" /&gt; &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre> <p>For a quick test if the configuration is correct I used console host app as a service host. Program.cs:</p> <pre><code>using System; using System.ServiceModel; namespace Externals { class Program { static void Main(string[] args) { var sh=new ServiceHost(typeof(ExecutionService)); sh.Open(); Console.WriteLine("Service running press any key to terminate..."); Console.ReadKey(); sh.Close(); } } } </code></pre> <p>Run the console app and try to add service reference to your project through <code>net.tcp://localhost:3040/ExecutionService/mex</code>. </p>
 

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