title: RESTful WCF Service returns "The resource cannot be found." error
body: <p>I have a RESTful service that doesn't work. When I type the URI into the address bar, I receive this error:</p>
  <blockquote>
  <p>The resource cannot be found.</p>
  <p>Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.</p>
  <p>Requested URL: /VirtualRUS/Service1.svc/</p>
  </blockquote>
  <p>I can't tell why its not working. I compared my code and web.config to a working example, and I can't find any differences.</p>
  <p><strong>EDIT:</strong> Also, I'm able to use the service just fine if I use a service reference. It just doesn't work if I navigate to the URI, or more importantly, when I try to make a <code>WebRequest</code>.</p>
  <p>Does anyone have any idea why this wouldn't work?</p>
  <p><strong>Service1.cs:</strong></p>
  <pre><code>[ServiceContract]
  public interface IService1
  {
     [OperationContract]
     [WebGet(UriTemplate = &quot;/&quot;)]
     string Test(); 
  }
  </code></pre>
  <p><strong>Service1.svc.cs:</strong></p>
  <pre><code>[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
  public class Service1 : IService1
  {
     public string Test()
     {
        return &quot;It works!!&quot;;
     }
  }
  </code></pre>
  <p><strong>Web.Config:</strong></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; ?&gt;
  &lt;configuration&gt;
      &lt;configSections&gt;
          &lt;sectionGroup name=&quot;system.web.extensions&quot; type=&quot;System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot;&gt;
              &lt;sectionGroup name=&quot;scripting&quot; type=&quot;System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot;&gt;
                  &lt;section name=&quot;scriptResourceHandler&quot; type=&quot;System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot; requirePermission=&quot;false&quot; allowDefinition=&quot;MachineToApplication&quot; /&gt;
                  &lt;sectionGroup name=&quot;webServices&quot; type=&quot;System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot;&gt;
                      &lt;section name=&quot;jsonSerialization&quot; type=&quot;System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot; requirePermission=&quot;false&quot; allowDefinition=&quot;Everywhere&quot; /&gt;
                      &lt;section name=&quot;profileService&quot; type=&quot;System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot; requirePermission=&quot;false&quot; allowDefinition=&quot;MachineToApplication&quot; /&gt;
                      &lt;section name=&quot;authenticationService&quot; type=&quot;System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot; requirePermission=&quot;false&quot; allowDefinition=&quot;MachineToApplication&quot; /&gt;
                      &lt;section name=&quot;roleService&quot; type=&quot;System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot; requirePermission=&quot;false&quot; allowDefinition=&quot;MachineToApplication&quot; /&gt;
                  &lt;/sectionGroup&gt;
              &lt;/sectionGroup&gt;
          &lt;/sectionGroup&gt;
      &lt;/configSections&gt;
      &lt;appSettings&gt;&lt;/appSettings&gt;
      &lt;connectionStrings&gt;
          &lt;add name=&quot;ResearchLibrary&quot; connectionString=&quot;Server=XXXXXX&quot; ; Initial Catalog=ResearchLibrary; user id=XXX; password=XXX &quot; /&gt;
       &lt;/connectionStrings&gt;
       &lt;system.web&gt;
          &lt;compilation debug=&quot;true &quot;&gt;
              &lt;assemblies&gt;
                  &lt;add assembly=&quot;System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089 &quot;/&gt;
                  &lt;add assembly=&quot;System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 &quot;/&gt;
              &lt;/assemblies&gt;
          &lt;/compilation&gt;
          
          &lt;authentication mode=&quot;Windows &quot;/&gt;
          
          &lt;pages&gt;
              &lt;controls&gt;
                  &lt;add tagPrefix=&quot;asp &quot; namespace=&quot;System.Web.UI &quot; assembly=&quot;System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 &quot;/&gt;
              &lt;/controls&gt;
          &lt;/pages&gt;
          &lt;httpHandlers&gt;
              &lt;remove verb=&quot;* &quot; path=&quot;*.asmx &quot;/&gt;
              &lt;add verb=&quot;* &quot; path=&quot;*.asmx &quot; validate=&quot;false &quot; type=&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 &quot;/&gt;
              &lt;add verb=&quot;* &quot; path=&quot;*_AppService.axd &quot; validate=&quot;false &quot; type=&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 &quot;/&gt;
              &lt;add verb=&quot;GET,HEAD &quot; path=&quot;ScriptResource.axd &quot; type=&quot;System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 &quot; validate=&quot;false &quot;/&gt;
          &lt;/httpHandlers&gt;
          &lt;httpModules&gt;
              &lt;add name=&quot;ScriptModule &quot; type=&quot;System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 &quot;/&gt;
          &lt;/httpModules&gt;
        &lt;httpRuntime maxRequestLength=&quot;65536 &quot;/&gt;
      &lt;/system.web&gt;
      &lt;system.codedom&gt;
          &lt;compilers&gt;
              &lt;compiler language=&quot;c#;cs;csharp &quot; extension=&quot;.cs &quot; warningLevel=&quot;4 &quot; type=&quot;Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 &quot;&gt;
                  &lt;providerOption name=&quot;CompilerVersion &quot; value=&quot;v3.5 &quot;/&gt;
                  &lt;providerOption name=&quot;WarnAsError &quot; value=&quot;false &quot;/&gt;
              &lt;/compiler&gt;
          &lt;/compilers&gt;
      &lt;/system.codedom&gt;
      &lt;system.web.extensions&gt;
          &lt;scripting&gt;
              &lt;webServices&gt;
              &lt;/webServices&gt;
          &lt;/scripting&gt;
      &lt;/system.web.extensions&gt;
      
      &lt;system.webServer&gt;
          &lt;validation validateIntegratedModeConfiguration=&quot;false &quot;/&gt;
          &lt;modules&gt;
              &lt;add name=&quot;ScriptModule &quot; preCondition=&quot;integratedMode &quot; type=&quot;System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 &quot;/&gt;
          &lt;/modules&gt;
          &lt;handlers&gt;
              &lt;remove name=&quot;WebServiceHandlerFactory-Integrated &quot;/&gt;
              &lt;add name=&quot;ScriptHandlerFactory &quot; verb=&quot;* &quot; path=&quot;*.asmx &quot; preCondition=&quot;integratedMode &quot; type=&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 &quot;/&gt;
              &lt;add name=&quot;ScriptHandlerFactoryAppServices &quot; verb=&quot;* &quot; path=&quot;*_AppService.axd &quot; preCondition=&quot;integratedMode &quot; type=&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 &quot;/&gt;
              &lt;add name=&quot;ScriptResource &quot; preCondition=&quot;integratedMode &quot; verb=&quot;GET,HEAD &quot; path=&quot;ScriptResource.axd &quot; type=&quot;System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 &quot;/&gt;
          &lt;/handlers&gt;
      &lt;/system.webServer&gt;
      &lt;system.serviceModel&gt;
          &lt;services&gt;
              &lt;service name=&quot;ResearchUploadService.Service1 &quot; behaviorConfiguration=&quot;ResearchUploadService.Service1Behavior &quot;&gt;
                  &lt;!-- Service Endpoints --&gt;
                  
              &lt;endpoint address=&quot;customBinding &quot; binding=&quot;customBinding &quot; bindingConfiguration=&quot;basicConfig &quot; contract=&quot;ResearchUploadService.IService1 &quot;/&gt;
              &lt;/service&gt;
          &lt;/services&gt;
          &lt;behaviors&gt;
              &lt;serviceBehaviors&gt;
                  &lt;behavior name=&quot;ResearchUploadService.Service1Behavior &quot;&gt;
                      
                      &lt;serviceMetadata httpGetEnabled=&quot;true &quot;/&gt;
                      &lt;
                      &lt;serviceDebug includeExceptionDetailInFaults=&quot;true &quot;/&gt;
                  &lt;/behavior&gt;
              &lt;/serviceBehaviors&gt;
        &lt;/behaviors&gt;
        &lt;bindings&gt;
           &lt;customBinding&gt;
              &lt;binding name=&quot;basicConfig &quot;&gt;
                 &lt;binaryMessageEncoding/&gt;
                 &lt;httpTransport transferMode=&quot;Streamed &quot; maxReceivedMessageSize=&quot;67108864 &quot;/&gt;
              &lt;/binding&gt;
           &lt;/customBinding&gt;
        &lt;/bindings&gt;
      &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>