MVC 응용 프로그램을 wcf 서비스에 연결 했으므로 다른 작업에 종속 된 작업을 특징으로하는 할 일 목록 응용 프로그램을 만들려고합니다. 지금까지는이 기능이 없지만 저장된 proc 파일을 빌드했습니다. 이제 WCF 서비스에서 호출하여 클라이언트에게 응답을 보냅니다.데이터리스트를 채우려 할 때 내 WCF 서비스가 시간 초과됩니까?
현재 클라이언트는 1 분 동안 응답하지 않으면 다음 오류를 표시합니다.
"The request channel timed out while waiting for a reply after 00:01:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout."
내 WCF 서비스의 코드는 다음과 같습니다.
public DataTable GetAllDependantTasks(string id)
{
DataTable dt = new DataTable();
try
{
using (SqlConnection conn = new SqlConnection())
using (SqlCommand com = new SqlCommand())
{
conn.ConnectionString = ConfigurationManager.ConnectionStrings["ToDoDatabase"].ConnectionString;
com.Connection = conn;
com.CommandText = "usp_GetAllDependantTaskInfoByID";
com.CommandType = CommandType.StoredProcedure;
com.Parameters.Add(new SqlParameter("@id", id));
conn.Open();
SqlDataReader returnvalue = com.ExecuteReader();
if (returnvalue.HasRows)
{
//List<DataRow> items = new List<DataRow>();
dt.Load(returnvalue);
// foreach (DataRow row in dt.Rows)
// {
// items.Add(row);
//}
return dt;
}
else
{
throw new RowNotInTableException();
}
}
}
catch (Exception ex)
{
//TODO: Write error to log
return new DataTable();
}
}
내 프런트 엔드에서 ASPX 페이지를 사용하고 있습니다. 문제가되는 코드는 다음과 같습니다.
private void LoadTasks()
{
// get the todo list items
ToDoService.ToDoServiceClient client = new ToDoService.ToDoServiceClient();
try
{
// List<ToDoService.ToDoItemContract> toDoItems = client.GetToDoItems("").ToList();
List<string> Items = new List<string>();
foreach(var row in client.GetAllDependantTasks("").Rows)
{
Items.Add(row.ToString());
}
dlTasks.DataSource = Items;
dlTasks.DataBind();
client.Close();
}
catch (Exception ex)
{
// TODO: Log error
client.Abort();
}
}
아무도 나에게 올바른 방향을 제시 할 수 있습니까? 프론트 엔드에서 프론트 엔드의 데이터리스트를 채우고 싶습니다. 기존 태스크와 함께 의존하는 태스크를 추가하고 싶습니다. wcf 서비스에서 datatable을 리턴하여리스트에 바인드하려고했지만, 좋아할 것 같지 않습니다. ! 사전 :
저장 프로 시저를 독립적으로 테스트 했습니까? 실행됩니까? 또한 WCF 인터페이스 및 계약서를 게시하십시오. –