简体   繁体   English

如何将HTTP标头添加到Web服务调用?

[英]How do I add an HTTP header to a web service call?

I'm calling a web service from a console app - all in C# on .NET. 我正在从控制台应用程序调用Web服务-全部在.NET上的C#中。

I want to add an HTTP header (not a SOAP header) to the web service call. 我想向Web服务调用添加HTTP标头(而不是SOAP标头)。 How do I do this? 我该怎么做呢?

This is what my code looks like so far: 到目前为止,这是我的代码:

EatService es = new EatService(); // web service added in Web References
// Add HTTP header X-Info = "extra info" here
string info = es.GetMoreInfo(); // ws call

如果您使用的是ASMX Web服务代理(Web参考),则这与将自定义Http标头添加到C#Web服务代理重复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM