Note that there are some explanatory texts on larger screens.

plurals
  1. POSet data to ADO database via WCF Web Service
    text
    copied!<p>I'm trying to create an application where I can insert data into a database via a Web Service. I have a good connection to my ADO Database but when I try to send information from my main application to my Web Service I get the following error. </p> <blockquote> <p>Could not find default endpoint element that references contract 'MathServiceReference.IMathService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.</p> </blockquote> <p>My main app</p> <pre><code>protected void btnMultiply_Click(object sender, EventArgs e) { ServiceReference1.MathServiceClient client = new ServiceReference1.MathServiceClient(); txtSvar.Text = client.Multiply(int.Parse(txtTal2.Text)).ToString(); } </code></pre> <p>My class in my Wwb Service</p> <pre><code>public int Multiply(int box2) { if (box2 == null) { return 1; } else { koppling db = new koppling(); var testet = new tests(); testet.namn = box2.ToString(); db.tests1.AddObject(testet); db.SaveChanges(); return 2; } } </code></pre> <p>My WCF configuration:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;configuration&gt; &lt;system.serviceModel&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior&gt; &lt;serviceMetadata httpGetEnabled="true" /&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>
 

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