title: Odata returning 404 error with jquery get
body: <p>I am trying to configure some odata navigation and cannot see what the issue is here.</p>
  
  <p>Config:</p>
  
  <pre><code>public class WebApiConfig
      {
          public static void Register(HttpConfiguration config)
          {
              ODataModelBuilder modelBuilder = new ODataConventionModelBuilder();
              var entitySetConfiguration = modelBuilder.EntitySet&lt;Catalog&gt;("Catalog");
              entitySetConfiguration.EntityType.Ignore(t =&gt; t.OutboundCatalogItems);
              entitySetConfiguration.EntityType.Ignore(t =&gt; t.OutboundColumns);
              entitySetConfiguration.EntityType.Ignore(t =&gt; t.OutboundProcessor);
              entitySetConfiguration.EntityType.Ignore(t =&gt; t.OutboundProcessorID);
              entitySetConfiguration.EntityType.Ignore(t =&gt; t.RelationshipId);
              entitySetConfiguration.EntityType.Ignore(t =&gt; t.CatalogConfigurationProperties);
              var model = modelBuilder.GetEdmModel();
              config.Routes.MapODataRoute("ODataRoute", "odata", model);
  
              config.EnableQuerySupport();
  
              config.Routes.MapHttpRoute(
                  name: "DefaultApi",
                  routeTemplate: "apicontrollers/{controller}/{id}",
                  defaults: new { id = RouteParameter.Optional }
                  );
          }
      }
  </code></pre>
  
  <p>Registration</p>
  
  <pre><code>public class MvcApplication : System.Web.HttpApplication
      {
          protected void Application_Start()
          {
              AreaRegistration.RegisterAllAreas();
              RouteConfig.RegisterRoutes(RouteTable.Routes);
              GlobalConfiguration.Configure(WebApiConfig.Register);
          }
  
          protected void Application_EndRequest(object sender, EventArgs e)
          {
              Helpers.DataAccess.DisposePDBUnitOfWork();
          }
      }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>public class CatalogController : EntitySetController&lt;Catalog, int&gt;
      {
          private readonly PDBCoreUnitOfWork _unitOfWork;
  
          public CatalogController()
          {
              _unitOfWork = new PDBCoreUnitOfWork(0);
          }
  
          public override IQueryable&lt;Catalog&gt; Get()
          {
              return _unitOfWork.Repository&lt;Catalog&gt;().Query().Get();
          }
  
          protected override void Dispose(bool disposing)
          {
              _unitOfWork.Dispose();
              base.Dispose(disposing);
          }
      }
  </code></pre>
  
  <p>Script</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
          var catalogApi = "/odata/Catalog";
          $.getJSON(catalogApi)
              .done(function(json) {
                  console.log("Json data: " + json);
              })
              .fail(function(jqxhr, textStatus, error) {
                  var err = textStatus + ", " + error;
                  console.log("Request Failed: " + err);
             });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>When using fiddler localhost:port/odata returns 404 so does localhost:port/odata/Catalog</p>
  
  <p>I must be missing some fundimentatl piece here.<a href="http://blog.longle.net/2013/10/09/upgrading-to-async-with-entity-framework-mvc-odata-asyncentitysetcontroller-kendo-ui-glimpse-generic-unit-of-work-repository-framework-v2-0/" rel="nofollow">Unit of work with oData</a></p>
  
  <hr>
  
  <p><strong>UPDATE</strong>
  When I comment out the following:</p>
  
  <pre><code>protected void Application_Start()
          {
              //AreaRegistration.RegisterAllAreas();
              //RouteConfig.RegisterRoutes(RouteTable.Routes);
              GlobalConfiguration.Configure(WebApiConfig.Register);
              //GlobalConfiguration.Configure(ODataConfig.Register);
          }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>public class WebApiConfig
      {
          public static void Register(HttpConfiguration config)
          {
              ODataModelBuilder modelBuilder = new ODataConventionModelBuilder();
              //var entitySetConfiguration = modelBuilder.EntitySet&lt;Catalog&gt;("Catalog");
              //entitySetConfiguration.EntityType.Ignore(t =&gt; t.OutboundCatalogItems);
              //entitySetConfiguration.EntityType.Ignore(t =&gt; t.OutboundColumns);
              //entitySetConfiguration.EntityType.Ignore(t =&gt; t.OutboundProcessor);
              //entitySetConfiguration.EntityType.Ignore(t =&gt; t.OutboundProcessorID);
              //entitySetConfiguration.EntityType.Ignore(t =&gt; t.RelationshipId);
              //entitySetConfiguration.EntityType.Ignore(t =&gt; t.CatalogConfigurationProperties);
              var model = modelBuilder.GetEdmModel();
  
              //config.MapHttpAttributeRoutes();
              config.Routes.MapODataRoute("odata", "odata", model);
  
              config.EnableQuerySupport();
  
              //config.Routes.MapHttpRoute(
              //    name: "DefaultApi",
              //    routeTemplate: "api/{controller}/{id}",
              //    defaults: new { id = RouteParameter.Optional }
              //    );
          }
      }
  </code></pre>
  
  <p>Typeing localhost/port/odata returns:</p>
  
  <pre><code>This XML file does not appear to have any style information associated with it. The document tree is shown below.
  &lt;service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xml:base="http://localhost:45837/odata"&gt;
  &lt;workspace&gt;
  &lt;atom:title type="text"&gt;Default&lt;/atom:title&gt;
  &lt;/workspace&gt;
  &lt;/service&gt;
  </code></pre>
  
  <p>But when i add <code>Catalog</code> after odata it throws 404 not found.  Still lost but making progress.</p>