apple-app-site-association从azure请求作为应用程序/JSON返回 [英] apple-app-site-association to return as application/JSON from a azure request

查看:217
本文介绍了apple-app-site-association从azure请求作为应用程序/JSON返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下要求,

在azure网站中请求URL作为文件时,根文件夹中可用的文件必须返回到"application/JSON"

When an URL is requested in the azure web site for a file, then the file available in root folder has to return to "application/JSON"

举个例子:

我有一个名为"apple-app-site-association"的文件,这是一个文本文件,在Azure的网站的根文件夹中有JsonData可用. 当我们在浏览器"mydomain.com \ appleConfiguration"中输入URL时,应该在浏览器中返回JSON文本.

I have a file called "apple-app-site-association", which is a text file which has JsonData available in the root folder of a web site in azure. When we enter the URL in browser "mydomain.com\appleConfiguration", that should return the JSON text in the browser.

文件"apple-app-site-association"的扩展名不应为".Json"

The file "apple-app-site-association" should not have the extension of ".Json"

我尝试在web.config中使用以下规则集,认为该规则集不准确,有人可以提出这一建议.

I tried using the following ruleset in the web.config, believe the rule set is not accurate, can some one suggest this.

此方法在IIS中可以正常运行,但在Azure托管站点中则不能.

 <rule name="Apple Universal Links" stopProcessing="true">
          <match url="^apple-app-site-association$"/>
          <action type="Redirect"  redirectType="application/json" url="^apple-app-site-association$"/>
         </rule>

推荐答案

按照以下五个简单步骤进行操作,

1)使用移动配置JSON内容创建"apple-app-site-association",并将其存储到本地系统.

1) Create the "apple-app-site-association" with the mobile configuration JSON content and store to the local system.

"apple-app-site-association"文件中的示例配置:

Sample configuration in the file "apple-app-site-association":

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "9JA89QQLNQ.com.apple.wwdc",
                "paths": [ "/wwdc/news/", "/videos/wwdc/2015/*"]
            },
            {
                "appID": "ABCD1234.com.apple.wwdc",
                "paths": [ "*" ]
            }
        ]
    }
}

2)将.Json文件复制到azure文件夹"wwwroot"的根目录中

2) Copy the.Json file to your root directory of the azure folder "wwwroot"

3)如果无法在您的网站上读取或保护json文件,请使用mime配置启用.json文件以在网站上显示

3) If the json file is not available or protected to read in your website, then use the mime configuration to enable the .json file to display in the web site

<staticContent> 
          <mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent> 

4)在"web.config"文件中创建一个规则,该规则将在Applebot机器人抓取您的网站进行苹果关联时提供Json值

4) Create a rule in the "web.config" file, which will provide the Json value when the Applebot robot crawl your site for the apple association

<system.webServer>


<rewrite>
      <rules>
        <rule name="apple_json_file">
                    <match url="^apple-app-site-association" />
                    <action type="Rewrite" url="apple-app-site-association.json" />
                </rule>
      </rules>

</rewrite>




</system.webServer> 

5)在浏览器中输入以下URL时,检查Json值是否正确显示在您的网站中

5) Check the Json value is displayed in your web site properly, when you enter the following URL in browser,

https://yourDomain/apple-app-site-association

http://branch.io/resources/aasa-validator/

注意:用有效的网站域名修改.

如果此方法正常,请转到验证器站点

if this works fine then Go to the validator site

https://search.developer.apple.com/appsearch-validation-tool

检查通用链接对您的网站有效.

Check the Universal links are valid for your web site.

这篇关于apple-app-site-association从azure请求作为应用程序/JSON返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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