如何从C#控制台应用程序调用Web服务 [英] how to call a web service from C# console application
本文介绍了如何从C#控制台应用程序调用Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在asp.net MVC web api中有这个简单的类:
i have this simple class in an asp.net MVC web api:
public class OrdersController : ApiController
{
// GET api/orders
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// POST api/orders
[HttpPost]
public void Post([FromBody]string value)
{
}
}
转到此网址: http:// localhost:55186 / api / orders [ ^ ]
返回:
going to this url: http://localhost:55186/api/orders[^]
returns:
<ArrayOfstring>
<string>value1</string>
<string>value2</string>
</ArrayOfstring>
如何在C#控制台应用程序中调用post方法?
谢谢,
Gabriel Sas
how can i call the post method in C# console application?
Thanks,
Gabriel Sas
推荐答案
检查这些:
如何:调用Web服务 [ ^ ]
C#中的Web服务简介 [ ^ ]
Web Services C Sharp .NET端到端教程 [ ^ ]
Check these:
How to: Call a Web Service[^]
Introduction to Web Services in C#[^]
Web Services C Sharp .NET End to End Tutorial[^]
这篇关于如何从C#控制台应用程序调用Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文