如何在我的Azure Web应用程序上配置IIS? [英] How to config IIS on my Azure web app?

查看:75
本文介绍了如何在我的Azure Web应用程序上配置IIS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法在我的本地IIS上构建我的网站应用。

I managed to build my website app on my local IIS.

这是web.config:

Here is web.config:

<configuration>  
    <system.webServer>
        <rewrite>  
            <rules>  
                <rule name="antdemo" enabled="true">
                    <match url="(api/)(.*)" />
                    <serverVariables>
                        <set name="X-Forwarded-For" value="{SERVER_PROTOCOL}" />
                        <set name="Host" value="{SERVER_NAME}" />
                        <set name="X-Real-IP" value="{REMOTE_ADDR}" />
                    </serverVariables>
                    <action type="Rewrite" url="https://preview.pro.ant.design/{R:0}" />
                </rule>
                <rule name="index" enabled="true" stopProcessing="false">
                    <match url="(api/.*)" negate="true" />
                    <conditions trackAllCaptures="true">
                        <add input="{HTTP_METHOD}" pattern="^GET$" />
                        <add input="{HTTP_ACCEPT}" pattern="^text/html" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/index.html" />
                </rule>
            </rules>
        </rewrite>
        <staticContent>
            <remove fileExtension=".json" />
            <mimeMap fileExtension=".json" mimeType="application/json" />
            <remove fileExtension=".js" />
            <mimeMap fileExtension=".js" mimeType="application/javascript" />
        </staticContent>
    </system.webServer>  
</configuration>

我设置"X-Forwarded-For","Host","X-Real-IP"和"X-Real-IP"。 allowServerVariables。

And I set "X-Forwarded-For", "Host", "X-Real-IP" to allowedServerVariables.

它在我的本地IIS环境中运行良好,但当我推送到Azure时,每个请求都获得404状态。

It works very well in my local IIS env, but when I push to Azure, every request get 404 status.

应该怎样我呢?

推荐答案

您是部署到普通App Service还是App服务容器( Windows或Linux)?您能否提供有关您的应用程序配置
和您的要求的更多信息?

导航到
Kudu控制台 {yoursite } .scm.azurewebsites。 净)GT;
调试控制台> CMD  并创建一个文件名  applicationHost.xdt    d:\\\ home \ site  目录
,允许您通过覆盖/转换为IIS设置允许的服务器变量。

Navigate to Kudu console({yoursite}.scm.azurewebsites.net)> Debug console > CMD and create a file name applicationHost.xdt under d:\home\site directory which allows you set the allowed server variables for IIS by overriding/transforming.

参考本文档部分

创作XDT转换
有关此主题的更多详细信息。

此外, 
参考文档  在Azure App Service中为Web应用程序启用
诊断日志记录
  for
启用日志并查看404错误的子状态代码。 

Refer this document section Authoring XDT transforms for more details on this topic.
Also, 
refer the documentation Enable diagnostics logging for web apps in Azure App Service for enabling the logs and review the sub-status code for 404 error. 

IIS集成中间件,配置转发标头中间件,以及ASP.NET核心模块配置
来转发方案(HTTP / HTTPS)和发出请求的远程IP地址。可能需要托管其他代理服务器和负载均衡器的应用程序。
结帐此

文档
了解详情。

此外,如果您希望更好地控制托管环境,您可以使用
杠杆 
应用程序服务
for Windows Containers


这篇关于如何在我的Azure Web应用程序上配置IIS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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