In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Today I'll talk to you about the fact that this method or property is not supported after calling HttpRequest.GetBufferlessInputStream. How to do, many people may not understand, in order to let you better understand, the editor summed up the following content, I hope you can gain something according to this article.
In. Net 4.5, WCF takes advantage of input streams with fewer buffers to achieve scalability. Therefore, when you try to access the HttpContext.Current.Request.InputStream property, you may encounter the following exception because the InputStream property attempts to let you process the Classic stream because none of them are compatible. You may also see another side effect of the HttpContext.Current.Request.Form parameter become null.
"this method or property is not supported after calling HttpRequest.GetBufferlessInputStream."
1. Add a simple HttpModule to the same WCF project that will access the InputStream property of each request before WCF reads it, so that it will force HttpContext.Request.ReadEntityBody to "Classic" and ensure compatibility.
Namespace SKWcfService {public class WcfReadEntityBodyModeWorkaroundModule: IHttpModule {public void Dispose () {} public void Init (HttpApplication context) {context.BeginRequest + = context_BeginRequest;} public void context_BeginRequest (object sender, EventArgs e) {/ / this forces HttpContext.Request.ReadEntityBody to be "Classic" and ensures compatibility. Stream stream = (sender as HttpApplication) .request. InputStream;}
two。
Register this module in web.config by adding the following line to the settings.
If your project cannot be modified, you can write the Http module in a separate assembly, GAC it separately, and register the module in web.config.
Now try to access the service it should be successful!
After reading the above, you do not support this method or property after calling HttpRequest.GetBufferlessInputStream. Do you have any further understanding of what to do? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.