Azure应用服务: how to add custom Handler mapping to process TXT files?

标签 azure iis

我想在 TXT 文件中使用 ASP.Net 指令。通常,我会为此添加一个处理程序映射器。但如何在 Azure 应用服务中做到这一点呢?添加以下处理程序 (D:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll): enter image description here

生成以下异常:

Most likely causes:
  • IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
  • IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
  • IIS was not able to process configuration for the Web site or application.
  • The authenticated user does not have permission to use this DLL.
  • The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

Things you can try:

  • Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
  • Check the event logs to see if any additional information was logged.
  • Verify the permissions for the DLL.
  • Install the .NET Extensibility feature if the request is mapped to a managed handler.
  • Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.

我认为我对这些建议无能为力。

那么将静态文件映射到 Azure 应用服务中的 ASP.Net 管道的正确方法是什么?

最佳答案

在Azure Web服务中,我们不必使用aspnet_isapi.dll来使用ASP.Net管道,因为内置服务器是IIS。我们可以看到下面的屏幕截图,我将 ASP.NET Core 发布到 Azure Web 应用程序,我们可以在根文件夹下看到 Microsoft.Owin.Host.SystemWeb.dll,这意味着我的 ASP. NET Core 应用程序托管在 IIS 中。 (除了IIS,还有其他更好的服务器支持OWIN吗?)。

因此,如果您正在使用 ASP.NET Core 并且想要使用 IIS 管道,我认为这是不可能的,因为在这种情况下 IIS 只是一个反向代理服务器。您需要删除 Microsoft.Owin.Host.SystemWeb.dll 并修改 web.config 文件(我尝试过并成功),但这样做会导致您的 ASP.NET核心应用程序崩溃。

如果您使用的是 ASP.NET Framework 或只是一个简单的静态 Web,我们可以使用我们的代码和 web.config 来实现。

enter image description here

关于Azure应用服务: how to add custom Handler mapping to process TXT files?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51850822/

相关文章:

iis - Web Deploy 创建虚拟目录并添加应用程序

生产服务器上的 ASP.NET session 问题

javascript - Azure 上的 JavaScript 中的 SQL 查询

ruby - 在 Azure AD 中通过 Graph API 创建应用程序时获取 'Service_InternalServerError'

angularjs - 当您必须登录时,Azure Active Directory (ADAL) 不会将您重定向到您尝试打开的页面

asp.net - 默认文档未尝试 IIS 8.5 中的所有文件

asp.net - WebForms UnobtrusiveValidationMode

c# - 调试 Http 触发器 Azure Function VS 2017

sql - 将 ASP.NET Core 应用程序发布到 Azure 不起作用

c# - 在 web.config 中包含数据库密码的潜在安全风险是什么