title: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://xxxxx.azurewebsites.net' is therefore not allowed access
body: <p>I am getting No 'Access-Control-Allow-Origin' header is present on the requested resource error when azure web application is requesting azure web API resource, but locally it is working fine, I am getting the above error after deployment when I am accessing the azure website.</p>
  
  <p>Below is the code:</p>
  
  <p><em>angular js service</em>:</p>
  
  <pre><code>function industrysearchservice(appConfig, $q) {
  
  var dsIndustry;
  var schemaIndustry = {
      data: function (response) {
          return response.value;
      },
      total: function (response) {
          return response['@odata.count'];
      },
      model: {
          id: "Industry"
      }
  };
  
  getIndustries = function (filter) {
  
      var deferred = $q.defer();
  
      var dsFetch = new kendo.data.DataSource({
          batch: false,
          schema: schemaIndustry,
          type: "odata-v4",
          serverFiltering: true,
          serverSorting: true,
          serverPaging: true,
          pageSize: 20,
  
          transport: {
              read: {
                  url: appConfig.odataUri + "/PSellerIndustryFilter",
                  dataType: "json",
                  data: {
                      $select: "Industry"
                  }
              }
          }
      });
  
      if (!angular.isUndefined(filter))
          dsFetch._filter = filter;
  
  
      dsFetch.fetch().then(function () {
          dsIndustry = dsFetch;
          deferred.resolve(dsIndustry);
  
      });
  
      return deferred.promise;
  }
  
  return { getIndustries: getIndustries };
  </code></pre>
  
  <p>}</p>
  
  <p><em>controller method:</em></p>
  
  <pre><code>public class PSellerIndustryFilterController : ODataController
      {
      PSellerContext db = new PSellerContext();
  
      private bool PSellerIndustryExists(System.Guid key)
      {
          return db.PSellerIndustryFilters.Any(p =&gt; p.Industry == key.ToString());
      }
      protected override void Dispose(bool disposing)
      {
          db.Dispose();
          base.Dispose(disposing);
      }
  
      [EnableQuery]
      public IQueryable&lt;PSellerIndustryFilter&gt; Get()
      {
          return db.PSellerIndustryFilters;
      }
  
      [EnableQuery]
      public SingleResult&lt;PSellerIndustryFilter&gt; Get([FromODataUri] System.Guid key)
      {
          IQueryable&lt;PSellerIndustryFilter&gt; result = db.PSellerIndustryFilters.Where(p =&gt; p.Industry == key.ToString());
          return SingleResult.Create(result);
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/E1NIJ.png" rel="nofollow noreferrer">enter image description here</a></p>