Making a HTTP request to Azure mobile services fro

2019-08-01 09:40发布

NET web site and a mobile service on azure. They're not on the same domains and hence i get the following error:

Failed to load resource: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access.

However, I edited the web config file as recommended in this article: http://encosia.com/using-cors-to-access-asp-net-services-across-domains/

and I added:

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Headers" value="Content-Type" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>

However, It still is showing errors. Is this supposed to be done differently when it comes to Azure and consuming a mobile service within the site?

1条回答
【Aperson】
2楼-- · 2019-08-01 10:08

Did you enable CORS for the mobile service? You can see an explanation here (search for CORS): http://www.windowsazure.com/en-us/documentation/articles/mobile-services-html-get-started/

Hope this helps,

Henrik

查看更多
登录 后发表回答