Note that there are some explanatory texts on larger screens.

plurals
  1. POSelf hosted WCF not reachable
    text
    copied!<p>Hi guys I just want a simple WinForm app with one button. When I press the button i want to start the selfhosted WCF service. I want to able to connect to this service with for example another client app (winforms) by just adding a service reference.</p> <p>However the solution that I created is not working. I can't get connected with adding a service reference to this service. I don't actually know what address to call than except the address that I defined in the app.config file. Any help would be great.</p> <p>Here is the app.config file.</p> <pre><code>&lt;configuration&gt; &lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="WindowsFormsApplication11.WmsStatService"&gt; &lt;endpoint address="http://192.168.0.197:87" binding="basicHttpBinding" bindingConfiguration="" contract="WindowsFormsApplication11.IWmsStat"/&gt; &lt;/service&gt; &lt;/services&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre> <p>And forms code:</p> <pre><code>namespace WindowsFormsApplication11 { public partial class Form1 : Form { public ServiceHost _host = null; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { _host = new ServiceHost(typeof(WmsStatService)); _host.Open(); } } // Define a service contract. [ServiceContract(Namespace = "http://WindowsFormsApplication11")] public interface IWmsStat { [OperationContract] string sayHello(string name); } public class WmsStatService : IWmsStat { public string sayHello(string name) { return "hello there " + name + " nice to meet you!"; } } } </code></pre>
 

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