Content-Length标头已删除 [英] Content-Length header is removed

查看:81
本文介绍了Content-Length标头已删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎我们在Azure中已经托管了一段时间的asp.net mvc(完整框架)已更改为Chuncked模式.

It seems the asp.net mvc (full framework) we've been hosting for a while in Azure is changed to Chuncked mode.

我们的WPF客户端应用程序依赖于要从服务器发送的content-length标头,但是该标头在最后几天会自动从响应中删除.

Our WPF client app depends on the content-length header to be send from the server, but the last days this header is automaticly removed from the response.

公共异步任务< ActionResult>索引(字符串appName,字符串ID,字符串curVersion){
AppFileInfo info = this.GetAppFile(appName,id,curVersion);
如果(info == null)返回新的HttpNotFoundResult(未找到应用程序");

this.Response.Buffer = false;
this.Response.BufferOutput = false;
this.Response.Headers ["Content-Encoding"] ="identity";
this.Response.Headers ["Transfer-Encoding"] ="identity";

版本v = Version.Parse(info.Version);
StorageHelper store = new StorageHelper();
FileStreamResult result = await store.GetFileStreamResult("versions",new string [] {appName,v.Major.ToString()},info.Name)为FileStreamResult;

this.Response.Headers.Add("Content-Length",result.FileStream.Length.ToString());

返回结果;
}

public async Task<ActionResult> Index(string appName, string id, string curVersion) {
AppFileInfo info = this.GetAppFile(appName, id, curVersion);
if (info == null) return new HttpNotFoundResult("Application Not Found");

this.Response.Buffer = false;
this.Response.BufferOutput = false;
this.Response.Headers["Content-Encoding"] = "identity";
this.Response.Headers["Transfer-Encoding"] = "identity";

Version v = Version.Parse(info.Version);
StorageHelper store = new StorageHelper();
FileStreamResult result = await store.GetFileStreamResult("versions", new string[] { appName, v.Major.ToString() }, info.Name) as FileStreamResult;

this.Response.Headers.Add("Content-Length", result.FileStream.Length.ToString());

return result;
}

如果我在开发箱上本地运行此代码,则可以按预期工作,当发布为天蓝色时,不会发送content-length标头.

If I run this code locally on my dev-box it works as expected, when published to azure, the content-length header is not send.

推荐答案

Hello Frank VDL, We apologize for the issue caused by a recent update. There was a fix that pushed out for this issue earlier today to resolve this. Everyone should be seeing relief by now. If you are still having trouble with this issue, can you please reply?


这篇关于Content-Length标头已删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆