title: Why is my ASP C# WCF Service not working?
body: <p>I am working on a project for school and I need to create a WCF service that I can use in my original solution.  </p>
  
  <p>I created the service by going to File -> New Project -> WCF Service Application (add to solution) and then I added the service reference by right clicking References under Assignment8 solution and new reference.  Then I discovered services in the solution and added the Product service. </p>
  
  <p>I am currently getting the <strong>error:</strong> </p>
  
  <blockquote>
    <p>'Assignment8.Product.ProductClient' does not contain a definition for 'UpdateProduct' and no extension method 'UpdateProduct' accepting a first argument of type 'Assignment8.Product.ProductClient' could be found (are you missing a using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>The error occurs in UpdateProduct.aspx.cs on the line with the if statement in the Button1_Click method.  What am I doing wrong?</p>
  
  <p>Here are my files:</p>
  
  <p><strong>IProduct.cs</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.ServiceModel.Web;
  using System.Text;
  
  namespace ProductService
  {
      // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
      [ServiceContract]
      public interface IProduct
      {
  
          [OperationContract]
          string GetData(int value);
  
          [OperationContract]
          CompositeType GetDataUsingDataContract(CompositeType composite);
  
          [OperationContract]
          Boolean UpdateProduct(int productID, string productName, string productDescription, decimal productPrice, decimal productCost);
  
          // TODO: Add your service operations here
      }
  
  
      // Use a data contract as illustrated in the sample below to add composite types to service operations.
      [DataContract]
      public class CompositeType
      {
          bool boolValue = true;
          string stringValue = "Hello ";
  
          [DataMember]
          public bool BoolValue
          {
              get { return boolValue; }
              set { boolValue = value; }
          }
  
          [DataMember]
          public string StringValue
          {
              get { return stringValue; }
              set { stringValue = value; }
          }
      }
  }
  </code></pre>
  
  <p><strong>Product.svc</strong></p>
  
  <pre><code>&lt;%@ ServiceHost Language="C#" Debug="true" Service="ProductService.Product" CodeBehind="Product.svc.cs" %&gt;
  </code></pre>
  
  <p><strong>Product.svc.cs</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.ServiceModel.Web;
  using System.Text;
  
  namespace ProductService
  {
      // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
      // NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
      public class Product : IProduct
      {
          public string GetData(int value)
          {
              return string.Format("You entered: {0}", value);
          }
  
          public CompositeType GetDataUsingDataContract(CompositeType composite)
          {
              if (composite == null)
              {
                  throw new ArgumentNullException("composite");
              }
              if (composite.BoolValue)
              {
                  composite.StringValue += "Suffix";
              }
              return composite;
          }
  
          public bool UpdateProduct(int productID, string productName, string productDescription, decimal productPrice, decimal productCost)
          {
              return false;
          }
      }
  }
  </code></pre>
  
  <p><strong>UpdateProduct.aspx.cs</strong></p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
          {
              using (Product.ProductClient orderproxy = new Product.ProductClient())
              {
                  if(orderproxy.UpdateProduct(Request.QueryString["ID"], txtProductName.Text, txtProductName.Text, txtProductDescription.Text, Convert.ToDecimal(txtProductPrice.Text), Convert.ToDecimal(txtProductCost.Text))){
                      Response.Redirect("~/ProductList.aspx");
                  } else {
                      lblStatus.Text = "The product could not be updated.";
                  }
              }
          }
  </code></pre>