gpt4 book ai didi

html - Windows Azure 网站和 Blob 存储中的静态 html

转载 作者:行者123 更新时间:2023-12-03 00:14:26 24 4
gpt4 key购买 nike

因此,我在 Azure 网站中发布了一个 .NET MVC 应用程序,当单击相应的超链接时,该应用程序应该提供存储在 Blob 容器中的静态 html 页面。

我的问题是:

  1. 访问 Azure 中的 blob 的方式是 https://blobtest.blob.core.windows.net/container/htmlpage1.html ,然而,奇怪的部分是当我登录到我的 Azure 站点并且 url 是就像是: http://azuretestwebapp.azurewebsites.net/user123如果我点击在我的 html blob 的超链接上,它通常会带我去blob azure 网站(当然)。因此我想知道是否有是一种获得类似于以下网址的方法: http://azuretestwebapp.azurewebsites.net/user123/container/htmlpage1.html考虑到 html 页面存储在 Azure 中的其他位置。
  2. 如果使用 Azure 网站或存储不可行Blob 中的静态 html 页面,什么是更好的方法?

提前感谢您抽出时间。

最佳答案

您可以修改站点的 web.config,以使用重定向规则将对静态页面的请求转发到 Blob 存储。然后,静态内容将存储在 Blob 存储中并从中提供服务。

将以下内容放入名为 web.config 的文件中(或修改现有的 web.config),并将 web.config 放入网站上的 site/wwwroot 文件夹中网站内容旁边。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="static" stopProcessing="true">
<match url="static/(.*)" />
<action type="Rewrite" url="https://blobtest.blob.core.windows.net/static/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

关于html - Windows Azure 网站和 Blob 存储中的静态 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30842249/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com