Foxtable(狐表)用户栏目专家坐堂 → [求助]无法访问已释放的对象这个错误具体怎么引起的,怎么消除这个错误?


  共有3849人关注过本帖树形打印复制链接

主题:[求助]无法访问已释放的对象这个错误具体怎么引起的,怎么消除这个错误?

帅哥哟,离线,有人找我吗?
浙江仔
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1326 积分:9609 威望:0 精华:1 注册:2010/7/21 14:20:00
[求助]无法访问已释放的对象这个错误具体怎么引起的,怎么消除这个错误?  发帖心情 Post By: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)

 回到顶部
帅哥哟,离线,有人找我吗?
浙江仔
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1326 积分:9609 威望:0 精华:1 注册:2010/7/21 14:20:00
  发帖心情 Post By: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编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
浙江仔
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1326 积分:9609 威望:0 精华:1 注册:2010/7/21 14:20:00
  发帖心情 Post By:2019/3/8 14:57:00 [显示全部帖子]

只能确定是跟这个页面的访问时间是同一时候

图片点击可在新窗口打开查看此主题相关图片如下:qq截图20190308145653.png
图片点击可在新窗口打开查看


[此贴子已经被作者于2019/3/8 14:57:47编辑过]

 回到顶部