Making a HTTP request to Azure mobile services from asp.net web site

我的未来我决定 提交于 2019-12-11 13:23:55

问题


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:


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



来源:https://stackoverflow.com/questions/22201252/making-a-http-request-to-azure-mobile-services-from-asp-net-web-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!