- 我已经通过nuget安装了以下软件:MaxMind.GeoIP2 3.0.0(https://www.nuget.org/packages/MaxMind.GeoIP2/#show-github-usage)。
-
我去下载了MaxMind DB二进制文件:(https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz)
-
然后我解压缩它。
-
我正在运行以下内容:
string countryResult = null;
using (var reader = new DatabaseReader(mmDBFile)
{
countryResult = reader.Country(ipAddress).Country.IsoCode;
}
我得到了例外:
PohErp.Test.TestPurchase.TestPurchaseService
MaxMind.Db.InvalidDatabaseException : The MaxMind Db file's search tree is corrupt: contains pointer larger than the database.
at MaxMind.Db.Reader.ResolveDataPointer[T](Int32 pointer,InjectableValues injectables)
at MaxMind.Db.Reader.Find[T](IPAddress ipAddress,Int32& prefixLength,InjectableValues injectables)
at MaxMind.GeoIP2.DatabaseReader.Execute[T](String ipStr,IPAddress ipAddress,String type,Boolean throwOnNullResponse)
at MaxMind.GeoIP2.DatabaseReader.Execute[T](String ipStr,Boolean throwOnNullResponse)
at MaxMind.GeoIP2.DatabaseReader.Country(String ipAddress)
at Lob.Backend.Core.Service.MaxMindCountryByIpService.getcountry(String ipAddress) in C:\work\projects\lob\lob-framework\Lob.Backend.Core\Service\CountryByIpService.cs:line 24
at PohErp.Web.Services.PurchaseService.Purchase(PurchaseRequest purchaseRequest,String ipAddress,Int64 customerId) in C:\work\projects\lob\poh-erp\PohErp.Web\Services\PurchaseService.cs:line 93
at PohErp.Test.TestPurchase.TestPurchaseService() in C:\work\projects\lob\poh-erp\PohErp.Test\TestPurchase.cs:line 96
--- End of stack trace from previous location where exception was thrown ---
.net core 3.0
Windows 10专业版
该文件在正确的文件夹中是100%且可读。
有什么可以搞砸的?”
谢谢