我想在 Asp .net core Web API POST 方法中传递很长的字符串作为参数,但是当我传递它时,它只需要开始几个单词。如何解决这个问题?
我传递的数据:
{
"Stack":" RtrnAddr Arg#1 Arg#2 Arg#3 Arg#4 Function or address
----------------- ----------------- ----------------- ----------------- ----------------- -------------------------------------------------------------------
00000000`378265ef0 : 00000000`00000001 00000000`38e97628 00000000`1efb5b50 00000000`00000000
00000000`0058000001 : 00000000`38e97628 00000000`1efb5b50 00000000`00000000 000007fe`ed12964e
00000000`38e987628 : 00000000`1efb5b50 00000000`00000000 000007fe`ed12964e ffffffff`fffffffe
00000000`1efb58b50 : 00000000`00000000 000007fe`ed12964e ffffffff`fffffffe 00000000`0028d830
00000000`000000000 : 000007fe`ed12964e ffffffff`fffffffe 00000000`0028d830 00000000`001e0644
"
}
api方法中的参数是否添加了[FromBody]属性?
例如:[FromBody] 字符串值
请参阅以下链接。可能有用。
https://www.codeproject.com/Tips/734080/How-to-Pass-a-Large-String-to-a-Web-API-Method-A-2
Data you are passing has no issue. It is working. Try this please.
Create another class like this.
public class StackData
{
public string Stack{ get; set; }
}
Then use that class with the parameter in api method as below.
public async Task<IActionResult> Post([FromBody] StackData Stack)