要写入流的字节数超过指定的Content-Length字节大小 [英] Bytes to be written to the stream exceed the Content-Length bytes size specified

查看:939
本文介绍了要写入流的字节数超过指定的Content-Length字节大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

'/ Roscon'应用程序中的服务器错误。



要写入流的字节数超过指定的Content-Length字节大小。



描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。



异常详细信息:System.Net.ProtocolViolationException:要写入流的字节超过指定的Content-Length字节大小。





来源错误:





第37行:StreamWriter writer = new StreamWriter (hwRequest.GetRequestStream());

第38行:writer.WriteLine(消息);

第39行:writer.Flush();

第40行:writer.Close();

第41行:



源文件:C:\TREE\Travelt.aspx .cs行:39







请咨询

解决方案

plz refer



如何在.NET中使用HttpWebRequest和HttpWebResponse [ ^ ]



-SG


你可能有要正确设置 hwRequest.ContentLength 属性,请参阅此代码示例位于MSDN [ ^ ]。


Server Error in '/Roscon' Application.

Bytes to be written to the stream exceed the Content-Length bytes size specified.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.ProtocolViolationException: Bytes to be written to the stream exceed the Content-Length bytes size specified.


Source Error:


Line 37: StreamWriter writer = new StreamWriter(hwRequest.GetRequestStream());
Line 38: writer.WriteLine(message);
Line 39: writer.Flush();
Line 40: writer.Close();
Line 41:

Source File: C:\TREE\Travelt.aspx.cs Line: 39



Pls advice

解决方案

plz refer

How to use HttpWebRequest and HttpWebResponse in .NET[^]

-SG


You probably have to properly set the hwRequest.ContentLength property, see this code sample here at MSDN[^].


这篇关于要写入流的字节数超过指定的Content-Length字节大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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