Vb.net System.IO.IOException Eror-进程无法访问文件以读取。。。

Vb.net System.IO.IOException Eror-进程无法访问文件以读取。。。,vb.net,io,Vb.net,Io,我的网站使用adatabase对客户所在国家进行地理定位 这是我的错误代码: System.IO.IOException Inner Exception: The process cannot access the file 'C:\*****\******\wwwroot\GEO2db\GeoLite2-Country.mmdb' because it is being used by another process. 下面是我从数据库中获取国家的代码(在我的母版页中调用): 在dispos

我的网站使用adatabase对客户所在国家进行地理定位

这是我的错误代码:

System.IO.IOException
Inner Exception:
The process cannot access the file 'C:\*****\******\wwwroot\GEO2db\GeoLite2-Country.mmdb' because it is being used by another process.
下面是我从数据库中获取国家的代码(在我的母版页中调用):


在dispose之后,尝试将'reader'变量设置为Nothing,或直接使用“Using”块…DatabaseReader实现IDisposable接口,因此我想最好将其放在Using块中,由于您的读卡器未被正确地“释放”或“关闭”,因此只需检查您是否没有在后台运行数据库服务,该服务在您尝试使用程序时已连接并访问数据库。如果该表是在数据库管理工具中打开的,则程序可能无法访问。否,我从未以任何方式连接到该数据库,除非网站进行连接。问题是,两个用户同时连接是否可能导致此错误?对不起,我忘了说这个错误不是一直发生的,只是随机发生的
Public Function GetGeoIPCountry() As String
    If HttpContext.Current.Request.IsLocal Then
        Return ""
    End If
    Dim ip As String = HttpContext.Current.Request.ServerVariables("REMOTE_ADDR")
    Dim FileWithPath As String = HttpContext.Current.Server.MapPath("~") & "GEO2db\GeoLite2-Country.mmdb"
    Dim reader = New DatabaseReader(FileWithPath)
    Dim Om = reader.Omni(ip)
    Dim country As String = Om.Country.Name
    reader.Dispose()
    Return country
End Function