title: (Not Found) Error in Azure Mobile Services .NET Backend
body: <p>Been stuck with that error till madness phases ... Please help</p>
  
  <p>I have created an Azure Mobile Service .NET backend, and am now trying to call its Post function from a Xamarin Android client</p>
  
  <p>I initialize and call the Insert async function (these are just snippets from my code)</p>
  
  <pre><code>private static IMobileServiceTable&lt;Todo&gt; _todoMobileServiceTable;
  
  public static bool? InitializeAms()
  {
      try
      {
          CurrentPlatform.Init();
          _mobileServiceClient = new MobileServiceClient(applicationUrl, applicationKey);
  
          _todoMobileServiceTable = _mobileServiceClient.GetTable&lt;Todo&gt;();
  
          return true;
      }
      catch (MalformedURLException malformedUrlException)
      {
          ReportHelper.Report(Tag, "There was an error creating the Mobile Service. Verify the URL", true, malformedUrlException);
      }
      catch (Exception exception)
      {
          ReportHelper.Report(Tag, "Error occurred during initialization of Azure Mobile Services", true, exception);
      }
  
      return null;
  }
  
  _todoMobileServiceTable.InsertAsync(Todo);
  </code></pre>
  
  <p>I get the following error when calling .InsertAsync(Todo)</p>
  
  <blockquote>
    <p>The request could not be completed. (Not Found)</p>
  </blockquote>
  
  <p>N.B:</p>
  
  <ul>
  <li><p>Azure storage client is not available for xamarin yet, and I have no other choice other than to use this dirty fork which is 1 year old and is made for iOS not Android (although it works fine with azure mobile service javascript) <a href="https://github.com/zgramana/IOSAzureBlobUploader" rel="nofollow">https://github.com/zgramana/IOSAzureBlobUploader</a></p></li>
  <li><p>It works if I use the browser 'try it out' button but it doesn't work when I call it from the xamarin client app.</p></li>
  <li><p>It works from the xamarin client app if I use the javascript mobile service</p></li>
  <li><p>This error occurs both on the local azure mobile service and the published one online</p></li>
  </ul>
  
  <p>Here is the WebApiConfig class</p>
  
  <pre><code>namespace Service.Ams
  {
      public static class WebApiConfig
      {
          public static void Register()
          {
              // Use this class to set configuration options for your mobile service
              ConfigOptions options = new ConfigOptions();
  
              // Use this class to set WebAPI configuration options
              HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));
  
              // To display errors in the browser during development, uncomment the following
              // line. Comment it out again when you deploy your service for production use.
              config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
  
              Database.SetInitializer(new ServiceAmsInitializer());
          }
      }
  
      public class ServiceAmsInitializer : ClearDatabaseSchemaIfModelChanges&lt;ServiceAmsDbContext&gt;
      {}
  }
  </code></pre>
  
  <p>Here is the TableController class</p>
  
  <pre><code>namespace Service.Ams.Controllers
  {
      public class TodoItemController : TableController&lt;TodoItem&gt;
      {
          protected override void Initialize(HttpControllerContext controllerContext)
          {
              base.Initialize(controllerContext);
              ServiceAmsDbContext serviceAmsDbContext = new ServiceAmsDbContext();
              DomainManager = new EntityDomainManager&lt;TodoItem&gt;(serviceAmsDbContext, Request, Services);
          }
  
          // GET tables/TodoItem
          [AuthorizeLevel(AuthorizationLevel.Admin)]
          public IQueryable&lt;TodoItem&gt; GetAllTodoItems()
          {
              return Query(); 
          }
  
          // GET tables/TodoItem/55D11C86-6EA6-4C44-AA33-337FC9A27525
          [AuthorizeLevel(AuthorizationLevel.Admin)]
          public SingleResult&lt;TodoItem&gt; GetTodoItem(string id)
          {
              return Lookup(id);
          }
  
          // PATCH tables/TodoItem/55D11C86-6EA6-4C44-AA33-337FC9A27525
          [AuthorizeLevel(AuthorizationLevel.Admin)]
          public Task&lt;TodoItem&gt; PatchTodoItem(string id, Delta&lt;TodoItem&gt; patch)
          {
               return UpdateAsync(id, patch);
          }
  
          // POST tables/TodoItem/55D11C86-6EA6-4C44-AA33-337FC9A27525
          [AuthorizeLevel(AuthorizationLevel.Anonymous)]
          public async Task&lt;IHttpActionResult&gt; PostTodoItem(TodoItem item)
          {
              string storageAccountName;
              string storageAccountKey;
  
              // Try to get the Azure storage account token from app settings.  
              if (
                  !(Services.Settings.TryGetValue("STORAGE_ACCOUNT_NAME", out storageAccountName) |
                    Services.Settings.TryGetValue("STORAGE_ACCOUNT_ACCESS_KEY", out storageAccountKey)))
                  Services.Log.Error("Could not retrieve storage account settings.");
  
              // Set the URI for the Blob Storage service.
              Uri blobEndpoint = new Uri(string.Format("http://127.0.0.1:10000/{0}/", storageAccountName));
  
              // Create the BLOB service client.
              CloudBlobClient blobClient = new CloudBlobClient(blobEndpoint, new StorageCredentials(storageAccountName, storageAccountKey));
  
              // Create a container, if it doesn't already exist.
              CloudBlobContainer container = blobClient.GetContainerReference(item.ContainerName);
              await container.CreateIfNotExistsAsync();
  
              // Create a shared access permission policy. 
              BlobContainerPermissions containerPermissions = new BlobContainerPermissions
              {
                  PublicAccess = BlobContainerPublicAccessType.Blob
              };
  
              // Enable anonymous read access to BLOBs.
              container.SetPermissions(containerPermissions);
  
              // Define a policy that gives write access to the container for 5 minutes.                                   
              SharedAccessBlobPolicy sasPolicy = new SharedAccessBlobPolicy
              {
                  SharedAccessStartTime = DateTime.UtcNow,
                  SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(5),
                  Permissions = SharedAccessBlobPermissions.Write
              };
  
              // Get the SAS as a string.
              item.SasQueryString = container.GetSharedAccessSignature(sasPolicy);
  
              // Set the URL used to store the image.
              item.ImageLqUri = string.Format("{0}{1}/{2}", blobEndpoint, item.ContainerName, item.ResourceNameLq);
              item.ImageHqUri = string.Format("{0}{1}/{2}", blobEndpoint, item.ContainerName, item.ResourceNameHq);
  
              // Complete the insert operation.
              TodoItem current = await InsertAsync(item);
              return CreatedAtRoute("Tables", new {id = current.Id}, current);
          }
  
          // DELETE tables/TodoItem/55D11C86-6EA6-4C44-AA33-337FC9A27525
          [AuthorizeLevel(AuthorizationLevel.Admin)]
          public Task DeleteTodoItem(string id)
          {
               return DeleteAsync(id);
          }
  
      }
  }
  </code></pre>
  
  <p>Here is the EntityData class</p>
  
  <pre><code>namespace Service.Ams.DataObjects
  {
      [Table("dbo.TodoItems")]
      public class TodoItem : EntityData
      {
          public string ContainerName { get; set; }
          public string ResourceNameLq { get; set; }
          public string ResourceNameHq { get; set; }
          public string SasQueryString { get; set; }
          public string ImageLqUri { get; set; }
          public string ImageHqUri { get; set; }
      }
  }
  </code></pre>