maxMind GeoIP数据库未打开

问题描述 投票:0回答:2

我已经导入了maxmind Dll并下载了GeoIp.dat数据库,以获取我已使用以下代码的IP地址的国家名称

        Dim ls As New LookupService("GeoIP.dat", LookupService.GEOIP_MEMORY_CACHE)
        'get country of the ip address

        Dim c As Country = ls.getCountry("24.24.24.24")
        Console.Write(" code: " & c.getCode() & vbLf)
        Console.Write(" name: " & c.getName() & vbLf)
        CountryName.Text = " name: " & c.getName() & vbLf

但是

Dim c As Country = ls.getCountry("24.24.24.24")

给我以下错误数据库已关闭。可能是什么问题

asp.net vb.net ip maxmind
2个回答
0
投票
我应该这样写

Dim ls As New LookupService(MapPath ("GeoIP.dat"), LookupService.GEOIP_MEMORY_CACHE) Dim c As Country = ls.getCountry("24.24.24.24") Console.Write(" code: " & c.getCode() & vbLf) Console.Write(" name: " & c.getName() & vbLf) CountryName.Text = " name: " & c.getName() & vbLf


0
投票
[MaxMind]是一家位于马萨诸塞州的数字地图公司,提供IP地址的位置数据。 MaxMind由Thomas“ TJ” Mather于2002年成立,总部位于沃尔瑟姆,因此这里是有关如何使用PHP,GeoIP和Maxmind来检测国家和城市的简单教程。

1)首先需要根据您的平台(如应用程序或Web或相应语言)使用您可以使用的IP地址。

2)然后在后端中,使用任何给定的链接发出卷曲请求,并获得带有国家,州,城市,坐标等的完整位置数组。

http://www.geoplugin.net/php.gp?ip=123.123.123.123 http://ip-api.com/php/123.123.123.123 http://ipinfo.io/123.123.123.123 http://api.codehelper.io/ips/?callback=codehelper_ip_callback&ip=12

有关完整的教程,请访问here
© www.soinside.com 2019 - 2024. All rights reserved.