Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF InvalidOperationException: A binding instance has already been associated to listen URI
    primarykey
    data
    text
    <p>I'm a beginner of WCF and I'm studying in Essential WCF.</p> <p>I encountered a problem when using ServiceContract NameSpace and Name. when I run the code, I catch a bellow InvalidOperationException. But I couldn't understand clearly.</p> <p><em>A binding instance has already been associated to listen URI 'http://localhost:8080/NamespaceChange01'. If two endpoints want to share the same ListenUri, they must also share the same binding object instance. The two conflicting endpoints were either specified in AddServiceEndpoint() calls, in a config file, or a combination of AddServiceEndpoint() and config.</em> </p> <p>Does anyone knows how to avide the InvalidOperationException ?</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; namespace NamespaceChange01 { [ServiceContract(Name = "MyServiceName", Namespace = "http://ServiceNamespace")] public interface IBurgerMaster { [return: MessageParameter(Name = "myOutput")] [OperationContract(Name = "OperationName", Action = "OperationAction", ReplyAction = "ReplyActionName")] double GetStockPrice(string ticker); } [ServiceBehavior(Namespace = "http://MyService")] public class BurgerMaster : IBurgerMaster { public double GetStockPrice(string ticker) { return 100.99; } } class Program { static void Main(string[] args) { ServiceHost host = new ServiceHost(typeof(BurgerMaster)); host.Open(); Console.ReadLine(); host.Close(); } } } </code></pre> <ul> <li><p>app.config</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="NamespaceChange01.BurgerMaster" behaviorConfiguration="mexServiceBehavior"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:8080/NamespaceChange01"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;endpoint name="basic" binding="basicHttpBinding" contract="NamespaceChange01.IBurgerMaster"/&gt; &lt;endpoint name="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="mexServiceBehavior"&gt; &lt;serviceMetadata httpGetEnabled="true"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre></li> </ul> <p>Thanks.</p>
    singulars
    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.
    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