获取本地json文件可以使用visual studio进行侧载,但不能使用Azure托管 [英] Getting local json file works on sideload with visual studio but not with Azure hosting

查看:76
本文介绍了获取本地json文件可以使用visual studio进行侧载,但不能使用Azure托管的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在使用xmlhttprequest从我的app.js获取本地.json文件。这在本地服务器上工作正常,但是当我将它发布到azure时,这个解决方案失败了。

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.

是否阻止了它?

是Azure阻止它?

有没有比使用http get方法检索.json文件更好的方法?

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

json文件正在托管天蓝色的webapp

The json file is being hosted on the azure webapp

感谢您的帮助!

推荐答案

您好Felipe Heliszkowski,

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?

如果是这样,您在SourceLocation元素中指定的加载项起始页的域是加载项的默认域。如果您的加载项尝试导航到另一个域,则不使用AppDomains和AppDomain元素,浏览器将在加载项窗格外打开
a新窗口。

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.

您也许可以尝试添加AppDomains元素,并将每个额外的域包含在加载项清单中自己的AppDomain子元素中。

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. -->



有关详细信息,请单击
here
引用AppDomain元素 



另外你可以参考
如何提供来自Windows Azure网站的静态.json文件




感谢您的理解。


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.


这篇关于获取本地json文件可以使用visual studio进行侧载,但不能使用Azure托管的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆