안녕하세요.이 코드를 사용하여 안녕하세요. 형식 문자열을 int로 변환 할 수 없습니다. webmethod : 함축적 인 형식 문자열을 int로 변환 할 수 없습니다.
CalculateSumOfList.ServiceReference1.Service1SoapClient client = new CalculateSumOfList.ServiceReference1.Service1SoapClient();
CalculateSumOfList.ServiceReference1.ArrayOfInt arrayOfInt = new CalculateSumOfList.ServiceReference1.ArrayOfInt();
arrayOfInt.AddRange(listInt);
int result = client.CalculateSum(arrayOfInt); //error here!
label1.Text = Convert.ToString(result);
내가 전화 오전의 WebMethod
은 여기에 있습니다 :namespace CalculateWebServiceSum
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string CalculateSum(List<int> listInt)
{
int[] sum = listInt.ToArray();
return sum.ToString();
}
}
}
왜 계속 같은 질문을합니까? 1 시간 전에 물어 본 질문에 잘못된 것이 있습니까? –
미안하지만 다른 질문은 string의 int의 초기 문제점과 관련이 있습니다. 이것은 웹 서비스의 sum 함수를 호출하는 것과 관련이 있습니다. –
하지만 정확히 똑같은 문제입니다! –