title: How to send data to and from ASP.NET 4.0 website and C# WCF (Web Service)
body: <p>I am wondering - in my ASP.NET 4.0 website how to connect to the web service I have running?</p>
  
  <p>This is essentially what I would like to accomplish, for testing before I apply it on a larger scale.  I want the website to be able to send a value (int) from the website to the getData() method in the web service (auto generated method) and return its result (string) back to the website.</p>
  
  <p><strong>This is my setup for the Website/IIS 7/WCF:</strong></p>
  
  <p>Steps for creating website and service via VS 2010 (.NET 4.0)
  Website:</p>
  
  <pre><code>File &gt; New Website
  I did not change anything on the default website template
  Build &gt; Publish Web Site
    Set target location to specific folder
    Other settings unchanged
  </code></pre>
  
  <p>IIS Settings:</p>
  
  <pre><code>Connections - Right Click &gt; Add Web Site
    Specified a site name
    Specified physical path
    Connect As:  Set the username/password
    Binding Default (http port 80)
  Connections - Right Click on Default Web Site &gt; Manage Web Site &gt; Stop
  ...So as not to end up with two websites on conflicting port
  Edit Permissions &gt; Add user "Everyone"
  MyNewSite &gt; Manage Website &gt; Start
  ...Clicked Browse Web Site &gt; Brows *.80 (http)
  </code></pre>
  
  <p>And the website ran just fine, I was able to access it locally and through vpn with the IP address.</p>
  
  <p>WCFService:</p>
  
  <pre><code>File &gt; New Project &gt; WCF Service Application
  ...I did not change any of the default settings in the WCF service
  </code></pre>
  
  <p>I ran WCF service as Admin, and it loaded the little test app where you can type in a value to the getData() method and it returns "You typed {some_number}".</p>
  
  <p>So as far as I know - everything is working with the website and the wcf service.  I tried also right clicking on the website in VS, and Add Service Reference and it was able to detect the WCF service....  however, I dont know that I should need to add a reference but simply connect to the WCF like I do to a database via a connection string of sorts.</p>