내 웹 서비스에서 함수를 호출하려고합니다. 동일한 기술이 페이지의 다른 영역에 사용되지만이 방법은 작동하지 않습니다.문자열을 함수에 전달할 때 StackOverflowException이 발생했습니다.
<asp:Repeater ID="rptDeleteTickets" runat="server">
<ItemTemplate>
<asp:UpdatePanel ID="DeleteTicketUpdatePanel" runat="server">
<ContentTemplate>
<li>
<asp:Label ID="lblTicketDescD" runat="server" Text='<%# Eval("typ_omschr") %>' /></li>
<li style="border-bottom: 1px solid white;">
<asp:Label ID="lblTicketPriceD" runat="server" Text='<%# Eval("typ_prijs") %>' />
<asp:ImageButton ID="btnDeleteTicket" runat="server" ImageUrl="~/Images/minus.png" Width="20px"
OnCommand="btnDeleteTicket_Command" CommandName='<%# Eval("typ_id") %>' meta:resourcekey="btnDeleteTicketResource1" />
</li>
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:Repeater>
btnDeleteTicket_Command
기능 : WebService에 이렇게 접촉
protected void btnDeleteTicket_Command(object sender, CommandEventArgs e)
{
try
{
String strTypId = e.CommandName.ToString();
int intResult = webService.Festivals_DeleteTicketFestival("1", "3");
divResult.Visible = true;
lblResult.ForeColor = System.Drawing.Color.White;
if (intResult == 1)
{
lblResult.Text = GetLocalResourceObject("SaveSuccess").ToString();
dsTicketsPerFestival = webService.Festivals_GetTicketTypesOfFestival(strFormIdFest);
Session["TicketsPerFestival"] = dsTicketsPerFestival;
}
else if (intResult == -1)
{
lblResult.ForeColor = System.Drawing.Color.LightSalmon;
lblResult.Text = GetLocalResourceObject("ErrorNoDeleted").ToString();
}
else if (intResult > 1)
{
lblResult.Text = GetLocalResourceObject("ErrorMultipleDeleted").ToString();
dsTicketsPerFestival = webService.Festivals_GetTicketTypesOfFestival(strFormIdFest);
Session["TicketsPerFestival"] = dsTicketsPerFestival;
}
}
catch (Exception fatal)
{
divResult.Visible = true;
lblResult.ForeColor = System.Drawing.Color.LightSalmon;
lblResult.Text = GetLocalResourceObject("Error").ToString();
}
}
:
이 영문 구문
webService.Festivals_DeleteTicketFestival("1", "3");
Festivals_DeleteTicketFestival(String festId, String typId)
기능 : 디버깅 나는 그 festId와 typI를 볼 수있다. d는 웹 서비스 내에서 null입니다.
[WebMethod]
public int Festivals_DeleteTicketFestival(String festId, String typId)
{
return Festivals_DeleteTicketFestival(festId, typId); //StackOverflowException shown here
}
public int deleteTicketFestival(String festId, String typId)
{
int deletedRows = -1;
try
{
sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["project"].ConnectionString);
sqlCommand = new SqlCommand("DeleteTicketFestival", sqlConnection);
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlAdapter = new SqlDataAdapter(sqlCommand);
sqlCommand.Parameters.Add(new SqlParameter("@festId", festId));
sqlCommand.Parameters.Add(new SqlParameter("@typId", typId));
sqlConnection.Open();
sqlTransaction = sqlConnection.BeginTransaction();
sqlCommand.Transaction = sqlTransaction;
deletedRows = sqlCommand.ExecuteNonQuery();
sqlTransaction.Commit();
}
catch (Exception e)
{
LoggingService.WriteLine(strApplicationName + " Delete festival ticket", e.Message);
if (sqlTransaction != null)
{
sqlTransaction.Rollback();
throw (e);
}
}
return deletedRows;
}
아마도 더 많은 경험을 가진 사람이 문제를 발견 할 수 있습니까? 감사합니다.
'throw (e);'는 스택 추적을 파괴합니다. 'throw;를 써라. – SLaks