WebApi多个参数,如何使用HttpClient post请求?

问题:使用JSON格式没有什么问题,但传递多个参数,则报错,不是404就是500,这是微软设计的bug吗?

WebApi里的代码:

[HttpPost]
        public string PostString([FromBody]string name, [FromBody] string address)
        {

            return $"your name is {name},address is {address}!";
        }

调用段代码:

string url1 = "http://localhost:51666/api/Test/PostString2";

            using (HttpClient client = new HttpClient())
            {
 
                Dictionary<string, string> dic = new Dictionary<string, string>()
                {
                    {"name", "curry"},
                    {"address", "curry's address"}
                };
                HttpContent content = new FormUrlEncodedContent(dic);
                HttpResponseMessage response = client.PostAsync(url1, content).Result;
                if (response.IsSuccessStatusCode)
                {
                    string result = response.Content.ReadAsStringAsync().Result;
                }
            }

 

看一下官网的api 应该是你写法不对