WebClient访问webService
static void Main(string[] args)
{
string uri = @"http://localhost:2645/Service1.asmx/HelloWorld1";
WebClient wc = new WebClient();
StringBuilder postData = new StringBuilder();
postData.Append("name=" + "mingyongcheng");
//下?面?是?utf-8编括?码?
byte[] sendData = Encoding.GetEncoding("utf-8").GetBytes(postData.ToString());
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
wc.Headers.Add("ContentLength", sendData.Length.ToString());
byte[] recData = wc.UploadData(uri, "POST", sendData);
//显?示?返う?回?值μ注痢?意癮编括?码?
string s = Encoding.GetEncoding("utf-8").GetString(recData);
}