로컬에서 디버그 모드와 라이브 서버에서 완벽하게 작동하는 aC# cascadingdropdown이 있지만 라이브 페이지를 볼 때 두 드롭 다운에서 [방법 오류 500]이 발생합니다 브라우저를 통해. 첫 번째 드롭 다운을 클릭하면 [Method Error 500]이 표시되고 두 번째 드롭 다운은 [Method Error 500]으로 채워집니다.AJAX 계단식 드롭 다운 방법 오류 500
[ScriptService]
public class WasteDropDown : System.Web.Services.WebService
{
[WebMethod]
public CascadingDropDownNameValue[] GetBinType(string knownCategoryValues, string category)
{
int wtID;
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
if (!kv.ContainsKey("Waste") || !Int32.TryParse(kv["Waste"], out wtID))
{
throw new ArgumentException("Couldn't find waste type.");
};
SqlConnection conn = new SqlConnection(myConn.conn);
conn.Open();
SqlCommand comm;
comm = new SqlCommand("dbo.sl_TLU", conn);
comm.CommandType = CommandType.StoredProcedure;
comm.Parameters.Add(new SqlParameter("@binWTID", SqlDbType.Int));
comm.Parameters["@binWTID"].Value = wtID;
SqlDataReader dr = comm.ExecuteReader();
List<CascadingDropDownNameValue> l = new List<CascadingDropDownNameValue>();
while (dr.Read())
{
l.Add(new CascadingDropDownNameValue(
dr["bT"].ToString(),
dr["bPLUID"].ToString()));
}
conn.Close();
return l.ToArray();
}
[WebMethod]
public CascadingDropDownNameValue[] GetWaste(string knownCategoryValues, string category)
{
SqlConnection conn = new SqlConnection(myConn.conn);
conn.Open();
SqlCommand comm;
comm = new SqlCommand("dbo.sl_binQWT", conn);
comm.CommandType = CommandType.StoredProcedure;
SqlDataReader dr = comm.ExecuteReader();
List<CascadingDropDownNameValue> l = new List<CascadingDropDownNameValue>();
while (dr.Read())
{
l.Add(new CascadingDropDownNameValue(
dr["binWT"].ToString(),
dr["wtID"].ToString()));
}
conn.Close();
return l.ToArray();
}
}
이 로그에는 ASP.Net 오류가 없습니다 :
<asp:DdlNoEventValidation ID="ddlWasteTypeList" runat="server" />
<asp:DdlNoEventValidation ID="ddlBinTypeList" runat="server" />
<asp:CustomValidator
ID="CustomValidator1" runat="server"
ControlToValidate="ddlBinTypeList"
OnServerValidate="CustomValidatorBinType_ServerValidate"
ValidateEmptyText="True"
>
</asp:CustomValidator>
<asp:CascadingDropDown ID="ccd1" runat="server"
ServicePath="WasteDropDown.asmx"
ServiceMethod="GetWaste"
TargetControlID="ddlWasteTypeList"
Category="Waste"
PromptText="select waste" LoadingText="[Loading waste...]"
/>
<asp:CascadingDropDown ID="ccd2" runat="server"
ServicePath="WasteDropDown.asmx"
ServiceMethod="GetBinType"
TargetControlID="ddlBinTypeList"
ParentControlID="ddlWasteTypeList"
Category="BinType"
PromptText="select bin" LoadingText="[Loading bins...]"
/>
여기 뒤에 ASMX 코드입니다 :
다음은 ASPX 코드입니다. 그러나, 나는 다른 웹 사이트에 동일한 서버에서 실행되는 유사한 ccd가 있고 완벽하게 작동합니다 - 매우 실망합니다.
나는 this Stackoverflow question을 보았지만 솔직히 해결책이 무엇인지 알지 못했습니다. bin 폴더에 중복 된 dll이없는 것 같지만. 나는 정말로 문제가 여기 어딘가에 있다고 생각한다.
SQL 쿼리를 두 번 확인했으며 데이터를 반환했습니다.
제안 사항? 나는 그 (것)들을 다 썼다!
편집 :
나는 실패한 요청 추적을 설정하고이 정말 도움이 결과를 얻을했습니다 같은 오류가 /wastedropdown.asmx/getwaste 및 wastedropdown.asmx에 대해 생성 된
MODULE_SET_RESPONSE_ERROR_STATUS Warning ModuleName="ManagedPipelineHandler", Notification="MAP_REQUEST_HANDLER", HttpStatus="500", HttpReason="Internal Server Error", HttpSubStatus="0", ErrorCode="The operation completed successfully. (0x0)", ConfigExceptionInfo=""Warning
을/getbintype
이 정보가 도움이 되었기를 바랍니다.
EDIT2 :
코드는 확실히 동일한 서버에 다른 웹 사이트에 잘 작동합니다. Fiddler가 다음 오류를 낳았습니다.
{"Message":"An attempt was made to call the method \u0027GetWaste\u0027 using a GET request, which is not allowed.","StackTrace":" at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"}
HELP!