Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将gzip添加到ASP.NET WebApi文件服务器?_C#_Asp.net_Asp.net Web Api_Gzip - Fatal编程技术网

C# 如何将gzip添加到ASP.NET WebApi文件服务器?

C# 如何将gzip添加到ASP.NET WebApi文件服务器?,c#,asp.net,asp.net-web-api,gzip,C#,Asp.net,Asp.net Web Api,Gzip,我有一个asp.net web api应用程序,它必须提供文件服务。为此,我使用内置文件服务器,如下所示: appBuilder.UseFileServer(fileServerOptions); 如何为通过此文件服务器提供服务的文件启用Gzip 我已尝试使用包Microsoft.AspNet.WebApi.MessageHandlers.Compression.Compressor,并将其应用于以下代码: config.MessageHandl

我有一个asp.net web api应用程序,它必须提供文件服务。为此,我使用内置文件服务器,如下所示:

            appBuilder.UseFileServer(fileServerOptions);
如何为通过此文件服务器提供服务的文件启用Gzip

我已尝试使用包Microsoft.AspNet.WebApi.MessageHandlers.Compression.Compressor,并将其应用于以下代码:

            config.MessageHandlers.Insert(0, new ServerCompressionHandler(new GZipCompressor(), new DeflateCompressor()));
但这没有帮助:(

提前谢谢