以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]无法访问已释放的对象这个错误具体怎么引起的,怎么消除这个错误? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=131893) |
-- 作者:浙江仔 -- 发布时间:2019/3/8 14:08:00 -- [求助]无法访问已释放的对象这个错误具体怎么引起的,怎么消除这个错误? 异步网页,导致出现以下错误,查了代码,找不出具体怎么引起的 2019-03-08 11:40:32.1428 调用的目标发生了异常。 在 System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) 在 System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) 在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) 在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 在 Foxtable.UserFunctions.Execute(String Name, Object[] Args) 无法访问已释放的对象。 对象名:“System.Net.HttpListenerRequest”。 在 System.Net.HttpListenerRequest.CheckDisposed() 在 System.Net.HttpListenerRequest.get_RequestBuffer() 在 System.Net.HttpListenerRequest.get_HttpMethod() 在 UserCode.A8iEVSOnphKiMnfHP(Object[] Args)
|
-- 作者:有点蓝 -- 发布时间:2019/3/8 14:27:00 -- 贴出具体代码看看 |
-- 作者:浙江仔 -- 发布时间:2019/3/8 14:34:00 -- Dim e As RequestEventArgs = Args(0) Dim wb As New weui Dim dt As DataTable Dim dt2 As DataTable Dim Openid As String = Functions.Execute("Http_Get_MpOpenid2",e,wb) If openid="" Then e.WriteString(wb.Build) e.Handled = True Return "" End If Dim fdr As DataRow= xDataTables("Person_info").SQLFind("openidband= \'" & Openid & "\' and is_band=\'1\' ") ‘xDataTables是改写过的用于异步状态的 \'下面生成网页 With wb.AddTabBar("", "tb1", 0) .AddPage("page1","首页","./images/button.png") \' If cmd.ExecuteScalar > 0 Then If fdr IsNot Nothing Then .AddButton("bt1","我","./images/cell.png","/userInfo.htm") Else .AddButton("bt1","我","./images/cell.png").Attribute = """ End If \' .AddButton("btn22","内容2").Attribute = """ End With With wb.AddDialog("","dlg1", "","") .AddButton("btnOK","确定","/userInfo.htm") .AddButton("btnCancel","取消") End With wb.AddPageTitle("page1","ph1","培训报名","安全生产 重在落实") If Openid >"" Then dt =Functions.Execute("personlist",Openid,"1") dt2 =Functions.Execute("personlist",Openid,"2") End If With wb.AddListGroup("page1","rdg1","培训报名信息") If dt.DataRows.Count > 0 Then For Each dr1 As DataRow In dt.DataRows If dr1("peixun") =True Then .Add( dr1("bmID"), dr1("name")+"|"+dr1("bmunit") ,"报名时间:"+dr1("createdate").tostring.SubString(0,10) ).Badge="已培训" Else .Add( dr1("bmID"), dr1("name")+"|"+dr1("bmunit") ,"报名时间:"+dr1("createdate").tostring.SubString(0,10) ).Badge="待培训" End If Next Else .Add("ls11" ,"未匹配报名信息!","" ) End If End With \' With wb.AddButtonGroup("page1","btg1",False) \'垂直排列 .Add("btn3", "进入报名页面").Attribute = """ .Add("btn4", "培训表格下载", "", "/qytable.htm" ) \'单击这个按钮可以打开foxtable主页 End With With wb.AddDialog("","dlg2", "报名须知","报名后下载报名表,参加培训时携带上交,等待短信或微信通知" ) \'.AddButton("btnCancel","取消").Kind = 1 .AddButton("btnOK","确定","/bmSearch.htm") End With With wb.AddListGroup("page1","rdg2","培训信息") If dt2.DataRows.Count > 0 Then For Each dr1 As DataRow In dt2.DataRows .Add( dr1("bmID"), dr1("name")+"|"+dr1("bmunit") ,"最近培训:"+dr1("Train_Date").tostring.SubString(0,10),"http://pxbm.deqsafety.gov.cn/pInfo.aspx?bmid=" + dr1("bmID") ) Next Else .Add("ls12" ,"未匹配培训信息!","" ) End If End With e.WriteString(wb.Build) e.Handled = True "Http_Get_MpOpenid2" : Dim e As RequestEventArgs = Args(0) Dim Openid As String \'微信用户Openid Dim code As String \'微信授权码 Dim state As String \'开发者id Dim wb As weui =args(1) If e.Cookies.ContainsKey("pxopenid") Then \'从cookie中获取微信用户id Openid = e.Cookies("pxopenid") Else If e.host<> "127.0.0.1" Then If String.IsNullOrEmpty(code) OrElse (e.GetValues.ContainsKey("code") AndAlso code <> e.GetValues("code")) Then \'If e.GetValues.ContainsKey("state") Then state = e.GetValues("state") \'url的值,这里存储微信用户公众号开发者id,如果只维护一个公众号,可以忽略这个 If e.GetValues.ContainsKey("code") Then \'url的值 code = e.GetValues("code") openid =Functions.Execute("WeChat_GetOpenid_mp",code) End If End If Else Openid ="otmQFs6MaQBpfCrkihqi_XMw4V4s" \'openid="otmQFs0aNsrqwkBhvt1oUTqfman4" End If End If If Openid >"" Then wb.Appendcookie("pxopenid",openid ) Dim cmd As new SQLCommand cmd.C cmd.CommandText = "Insert Into wxWeblog(host,path,CREATE_TIME,openid) Values(?,?,?,?)" cmd.Parameters.Add("@11",e.host) cmd.Parameters.Add("@22",e.path ) cmd.Parameters.Add("@66",now.Tostring.replace("-","").replace(" ","").replace(":","")) cmd.Parameters.Add("@44",openid) cmd.ExecuteNonQuery Return openid Else Dim ul2 As String If redirectUl="true" Then ul2 ="http://es.XXXXXX.cn/get-weixin-code.html?appid={0}&scope=snsapi_base&state="+ mpCorpID +"&redirect_uri="+ UrlEncode("http://" & e.host & "/" & e.path ) Else ul2 ="https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri="+ UrlEncode("http://" & e.host & "/" & e.path )+ "&response_type=code&scope=snsapi_base&state="+ mpCorpID +"#wechat_redirect" End If ul2=CExp(ul2,mpCorpID) wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'跳转到授权链接 Return "" End If [此贴子已经被作者于2019/3/8 15:08:49编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/3/8 14:49:00 -- 确定是这段代码的问题?日志跟踪看运行到哪一句代码出错 |
-- 作者:浙江仔 -- 发布时间:2019/3/8 14:57:00 -- 只能确定是跟这个页面的访问时间是同一时候 [此贴子已经被作者于2019/3/8 14:57:47编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/3/8 15:09:00 -- 在各个可能出问题的地方加上日志记录,信息量太少,不好判断 |