none
Getting local json file works on sideload with visual studio but not with Azure hosting RRS feed

  • Question

  • Hello,

    I'm using a xmlhttprequest to get a local .json file from my app.js . This works fine in a local server, but when i publish it to azure this solution fails.

    Is it Word blocking it?

    Is it Azure blocking it?

    Is there any better way than using a http get method for retrieving a .json file?

    The json file is being hosted on the azure webapp

    Thanks for the help!

    Monday, October 10, 2016 8:40 AM

All replies

  • Hi Felipe Heliszkowski,

    According to your description, do you work fine when Office add-in and .json file are all on local,but fail when Office add-in is on local and .json file hosted on the azure webapp?

    If so, the domain of the add-in start page that you specify in the SourceLocation element is the default domain for the add-in. Without using the AppDomains and AppDomain elements, if your add-in attempts to navigate to another domain, the browser will open a new window outside of the add-in pane.

    You maybe could try to add an AppDomains element and include each additional domain in its own AppDomain sub-element in the add-in manifest.

    <!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
      <AppDomains>
        <AppDomain>Your Domain</AppDomain>
      </AppDomains>
      <!--End Basic Settings. -->


    For more information, click here to refer to AppDomain element 

    In addition you could refer to How to serve static .json files from a Windows Azure Website

    Thanks for your understanding.

    • Proposed as answer by David_JunFeng Friday, October 14, 2016 9:43 AM
    Tuesday, October 11, 2016 5:59 AM
  • Thank you for your response.

    Yes locally everything works.  But after i host the office addin on azure it fails to get the json file which also was deployed.

    The structure is something like this :

    App \ 

    Home.html

    Home.js

    Home.css

    Resources\

    file.json

    On home.js i have a function in which i perform a HTTP GET Request with a path of '/Resources/file.json'

    When side loading it with visual studio, it works fine. After azure hosts it, not at all. 

    What would be the domain i have to input? Just the generic https://webapp.azurewebsites.net/ or the exact path to the file.json?

    Sunday, October 16, 2016 7:00 PM
  • >>>On home.js i have a function in which i perform a HTTP GET Request with a path of '/Resources/file.json'

    When side loading it with visual studio, it works fine. After azure hosts it, not at all.<<<

    According to your description, since Office add-in of a compliant web app is a static HTML webpage. The page can be hosted on any web server, or web hosting service, such as Microsoft Azure. You can host your web app on the service that you choose.

    So I suggest that you could create web application(ASP.Net) that perform a HTTP GET Request with a path of '/Resources/file.json', then hosted it on Microsoft Azure, could you reproduce this issue?

    Thanks for your understanding.

    Monday, October 17, 2016 8:02 AM