![](/img/trans.png)
[英]WCF HTTP Headers Using HttpRequestMessageProperty and OperationContextScope
[英]How to add headers to HttpRequestMessageProperty in UWP
我正在將某些代碼從本機C#項目遷移到Universal Windows項目,並嘗試執行以下操作:
HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();
httpRequestProperty.Headers.Add("X-EBAY-SOA-SECURITY-APPNAME", "APPID");
httpRequestProperty.Headers.Add("X-EBAY-SOA-OPERATION-NAME", "findItemsByKeywords");
httpRequestProperty.Headers.Add("X-EBAY-SOA-GLOBAL-ID", "EBAY-US");
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
在C#本機中,我可以向集合中添加標頭,而在UWP中則是不可能的。 似乎System.ServiceModel.Http版本4.0.1.0中的HttpRequestMessageProperty.Headers僅是Getter ...
UWP中的替代方法是什么? 如何將標頭添加到集合中?
好吧...
httpRequestProperty.Headers["X-EBAY-SOA-SECURITY-APPNAME"] = "APPID";
httpRequestProperty.Headers["X-EBAY-SOA-OPERATION-NAME"] = "findItemsByKeywords";
httpRequestProperty.Headers["X-EBAY-SOA-GLOBAL-ID"] = "EBAY-US";
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.