2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

monoでASP.NET APIがMissing Methodを吐く

2
Last updated at Posted at 2016-05-27

単純に言っちゃうとHttpRequestBaseにGetBufferedInputStreamがない。
Mono 4.3.x系を入れると問題が解決するようだがMono 4.2.xでどうやって対応するか。
今回はPostハンドラをクイックハックした。

# if MONO
        public string Post()
        {
            var buffer = HttpContext.Current.Request.BinaryRead(HttpContext.Current.Request.ContentLength);
            var jsonStr = System.Text.Encoding.ASCII.GetString(buffer);

            T parsed = JsonConvert.DeserializeObject<T>(jsonStr);
# else
        public string Post([FromBody]T parsed)
        {
# endif
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?