title: WCF service showing blank in browser
body: <p>I am new to WCF and I have added a sample WCF service to my project but when I try to access webservice method through browser it shows blank window. I searched google for the solution but on solving one issue another issue arises I want to know how to get value returned by service in my browser window in json format.</p>
  
  <p>My code is like this:</p>
  
  <pre><code>[ServiceContract]
  
  public interface IService
  {   
  
      [OperationContract]
      [WebGet(UriTemplate = "DoWork", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
          int DoWork();
  }
  </code></pre>
  
  <p>Class is like this:</p>
  
  <pre><code>public class Service : IService
  {
      private int counter=0;
      public int DoWork()
      {
          counter++;
          return counter;
      }
  }
  </code></pre>
  
  <p>Web.config is like this:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=169433
    --&gt;
  &lt;configuration&gt;
      &lt;connectionStrings&gt;
          &lt;add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/&gt;
      &lt;/connectionStrings&gt;
      &lt;system.web&gt;
          &lt;compilation debug="true" targetFramework="4.0"/&gt;
          &lt;authentication mode="Forms"&gt;
              &lt;forms loginUrl="~/Account/Login.aspx" timeout="2880"/&gt;
          &lt;/authentication&gt;
          &lt;membership&gt;
              &lt;providers&gt;
                  &lt;clear/&gt;
                  &lt;add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/&gt;
              &lt;/providers&gt;
          &lt;/membership&gt;
          &lt;profile&gt;
              &lt;providers&gt;
                  &lt;clear/&gt;
                  &lt;add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/&gt;
              &lt;/providers&gt;
          &lt;/profile&gt;
          &lt;roleManager enabled="false"&gt;
              &lt;providers&gt;
                  &lt;clear/&gt;
                  &lt;add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/&gt;
                  &lt;add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/&gt;
              &lt;/providers&gt;
          &lt;/roleManager&gt;
      &lt;/system.web&gt;
      &lt;system.webServer&gt;
          &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
      &lt;/system.webServer&gt;
      &lt;system.serviceModel&gt;
  
      &lt;services &gt;
        &lt;service name="Service"&gt;
          &lt;endpoint address ="http://localhost:1726/WcfSessionMgt/Service.svc" contract ="IService" binding ="basicHttpBinding"  listenUri="/" &gt;&lt;/endpoint&gt;
          &lt;endpoint address="mex" contract="IMetadataExchange" binding="mexHttpBinding"/&gt;
        &lt;/service&gt;
  
      &lt;/services&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" aspNetCompatibilityEnabled="false" /&gt;
      &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>