如何在我的Azure Web应用程序上配置IIS?

编程入门 行业动态 更新时间:2024-10-25 10:29:57
本文介绍了如何在我的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="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)> Debug console > CMDand create a file nameapplicationHost.xdtunderd:\home\sitedirectory 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 documentationEnable diagnostics logging for web apps in Azure App Servicefor enabling the logs and review the sub-status code for 404 error.

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

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

更多推荐

如何在我的Azure Web应用程序上配置IIS?

本文发布于:2023-11-12 03:38:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580401.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   如何在   Web   Azure   IIS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!