title: Hosting WCF Services in Asp.Net MVC Project
body: <p>I have a solution with 3 projects:</p>
  
  <ol>
  <li>ConsoleClient (for testing WCF service)</li>
  <li>ServiceLibrary (for WCF)</li>
  <li>Web (asp.net mvc project)</li>
  </ol>
  
  <p>I have done some settings in my ServiceLibrary project in app.config</p>
  
  <pre><code>  &lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service name="MrDAStoreJobs.ServiceLibrary.AdvertisementService"&gt;
          &lt;clear /&gt;
          &lt;endpoint address="http://localhost:8050/ServiceLibrary/basic" binding="basicHttpBinding" bindingConfiguration="" contract="MrDAStoreJobs.ServiceLibrary.Interface.IAdvertisementService" /&gt;
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="http://localhost:8050/Design_Time_Addresses/MrDAStoreJobs/ServiceLibrary/AdvertisementService/" /&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;!-- To avoid disclosing metadata information, 
            set the value below to false before deployment --&gt;
            &lt;serviceMetadata httpGetEnabled="True" /&gt;
            &lt;!-- To receive exception details in faults for debugging purposes, 
            set the value below to true.  Set to false before deployment 
            to avoid disclosing exception information --&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="False" /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
    &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>When I run this project, everythings seems normally using wcf test client.</p>
  
  <p>Now, i have also added a <code>WcfDataServiceTest.svc</code> in my <code>Web project(mvc)</code> to host my wcf service.</p>
  
  <p><strong>So, my questions are:</strong></p>
  
  <ol>
  <li>what configuration do I need for my web project (web.config) to actually host this wcf service?</li>
  <li>And then I want to run the console app to test it?</li>
  </ol>
  
  <p><strong>Note:</strong> i have tested my service using console project but that was getting proxy generation from WCF test client.</p>
  
  <p>By the way, the wcfDataServiceTest.svc file looks like this:</p>
  
  <pre><code>public class WcfDataServiceTest : DataService&lt;AdvertisementService&gt;
  {
      // This method is called only once to initialize service-wide policies.
      public static void InitializeService(DataServiceConfiguration config)
      {
          // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
          // Examples:
          config.SetEntitySetAccessRule("Advertisements", EntitySetRights.AllRead);
          // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
          config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
      }
  }
  </code></pre>