我在一个简单的控制台应用程序中托管我的单声道 WebApi 项目:

WebApp.Start<Test>("http://localhost:1234/")

当我收到服务器的响应时,始终包含“Server”标头,我找不到删除它的方法。

例如服务器:Mono-HTTPAPI/1.0

你能帮我吗?

有帮助吗?

解决方案

基于Mono源代码,

https://github.com/mono/mono/blob/master/mcs/class/System/System.Net/HttpListenerResponse.cs

如果你没有设置 Server header 自行设置,Mono 将设置默认值 Mono-HTTPAPI/1.0 为你。因此,为了避免看到默认值,请设置 Server 使用您自己的字符串的标头。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top