首页 > 解决方案 > Azure - 删除服务器”和“x-powered-by”.net core 3.1

问题描述

我正在 Azure 中部署 webapi (.net core 3.1)。我读了这篇文章... 如何删除 .net core 2.0 中的 x-powered-by 标头删除 ASP.Net Core 2.2 InProcess 上的 HTTP 标头

我创建了 web.confi,并在发布时进行了输出,文件在此处创建“...\obj\Debug\netcoreapp3.1\PubTmp\Out”,其结构如下:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <security>
      <requestFiltering removeServerHeader="true" />
    </security>
    <httpProtocol>
      <customHeaders>
        <remove name="X-Powered-By" />
      </customHeaders>
    </httpProtocol>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\xdws.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" />
  </system.webServer>
</configuration>

但是,仍然显示“服务器”和“x-powered-by”信息,就像这张图片一样。

图像信息

标签: c#azureheader

解决方案


推荐阅读