這是我的第一篇文章,我希望你能幫助我=)....嗯,我是新的Web服務開發,我正在做一個使用Visual Studio2010的WCF服務的Android項目。所以,我想送字符串(或其他類型的對象)的列表,使用網絡服務這個我到目前爲止什麼:在wcf服務的數組參數
這是合同我的數據
namespace Android.WebService
{
[DataContract]
public class Modelo
{
[DataMember(Name = "MSG")]
public string Mensaje { get; set; }
[DataMember]
public int Con { get; set; }
}
}
這裏是我的接口
[ServiceContract]
public interface IService
{
[OperationContract]
[WebGet(
BodyStyle=WebMessageBodyStyle.WrappedRequest,
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "validarUsuario/?user={user}&pass={pass}")]
string validarUsuario(String user, String pass);
}
最後:
public class Service : IService
{
public string Redirect(String metodo, String[] data) {
clsGestor gestor = new clsGestor();
return "AUN";
}
}
最後,我得到這個錯誤
Laoperación'Redirect'del contrato'IService'tiene una variable de consulta llamada'data'del tipo'System.String []',pero el tipo'System.String []'no lo puede convertir'QueryStringConverter'。 Las variables delets valores de consulta de UriTemplate deben tener tipos que'QueryStringConverter'pueda convertir。
對不起fot語言(西班牙語),但它是關於QueryStringConverter,它說它不能讀取System.String []。謝謝
這是什麼問題?試試吧,如果你有困難回來... :)你會從中學到更多:) – Chris 2012-08-01 13:00:17
感謝您的回覆。事實上,我做到了,而且我得到這個錯誤:Laoperación'Redirect'del contrato'IService'tiene una variable de consulta llamada'data'del tipo'System.String []',pero el tipo'System.String []'沒有轉換爲'QueryStringConverter'。對於語言(西班牙語),抱歉的語言(西班牙語),但錯誤是,QueryStringConverter,它不能讀取System.String []類型。 – user1568613 2012-08-01 14:16:00