C# 如何在WCF呼叫中识别设备类型
如何检测iOS或Android是否请求wcf呼叫 我有以下WCF方法C# 如何在WCF呼叫中识别设备类型,c#,android,ios,wcf,C#,Android,Ios,Wcf,如何检测iOS或Android是否请求wcf呼叫 我有以下WCF方法 public Stream GetSmartLinkImage(string SmartLinkId) { wmas_subsDataContext dc = new wmas_subsDataContext(); string path = string.Empty; var fileRecord = from p in dc.Images where p.ImageTitl
public Stream GetSmartLinkImage(string SmartLinkId)
{
wmas_subsDataContext dc = new wmas_subsDataContext();
string path = string.Empty;
var fileRecord = from p in dc.Images where p.ImageTitle == "IMG0001" select p;
if (fileRecord.Count() > 0)
{
path = ConfigurationManager.AppSettings["ImagesPath"].ToString() + "\\" + fileRecord.First().ImageName;
}
FileStream fs = File.OpenRead(path);
return fs;
}
您可以在SmartLinkId类型中添加类似“DeviceType”属性的内容,并在客户端设置该属性。我需要一种无需发送参数即可自动工作的方法。我需要知道,在我的wcf方法中,是否有办法检测到呼叫的手机是ios还是android。我担心这是不可能的。根据这些问题:并且,您必须将信息作为参数传递,或者将其包含在自定义标题中。如果没有它,您将无法识别客户端设备。如果我在WCF方法中获得IIS头,那么我可能可以知道设备类型。我可以吗?