Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF Exception: InvalidOperationException was unhandled
    primarykey
    data
    text
    <p>Since I'm contemplating to use WCF I thought it would be best to just follow a simple tutorial to get my feet wet.</p> <p>3 hours later, I've only got one exception to show for. It won't go away.</p> <p>I ruled out the app.config not being loaded. If I change: wsHttpBinding in the config to JHGHJGH it gives an error when running. However when I change the name of the contract interface, no errors are given (except the same one I'm facing for the last 3 hours)</p> <p>Does anyone have an idea how to debug this? This kind of blackbox error stuff is very off-putting for me.</p> <p>full exception:</p> <blockquote> <p>Service 'WCFtest.TestService' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element</p> </blockquote> <p>(Don't you love these errors which indicate any of 16 possible things which might be wrong)</p> <p>my program.cs</p> <pre><code>ServiceHost host; Type serviceType = typeof(TestService); host = new ServiceHost(serviceType); host.Open(); //&lt;---- exception is thrown here Console.ReadLine(); </code></pre> <p>my test 'wcf service'</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; namespace WCFtest { [ServiceContract] public interface ITest { [OperationContract] double Add(double n1, double n2); [OperationContract] double Subtract(double n1, double n2); [OperationContract] double Multiply(double n1, double n2); [OperationContract] double Divide(double n1, double n2); } public class TestService : ITest { public double Add(double n1, double n2) { double result = n1 + n2; return result; } etc... some methods are removed for brevity } } </code></pre> <p>my 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="WCFtest.testservice" behaviorConfiguration="testservicebehaviour"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:8080/test"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;endpoint address="" binding="wsHttpBinding" contract="WCFtest.ITest" /&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="testservicebehaviour"&gt; &lt;serviceMetadata httpGetEnabled="true"/&gt; &lt;serviceDebug includeExceptionDetailInFaults="False"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre>
    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.
    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