Try our conversational search powered by Generative AI!

Unable to read field from web.config needed for MaxMind.GeolocationProvider



After updating to CMS Core 10.10.1 (from an early 10 version) I seem to have an issue with MaxMind. I'm unsure if it's a MaxMind related issue or has something to do with the configuration (which I haven't touched.) Basically it looks like the code is unable to fetch the property "databaseFileName" from web.config.



Place where referenced (it's a scheduled Job):

var maxmindProviderConfig = EPiServerFrameworkSection.Instance.Geolocation.Providers["maxmind"];
_liveDatabaseFileName = Web.VirtualPathUtilityEx.RebasePhysicalPath(maxmindProviderConfig.Parameters["databaseFileName"]);

I get an "Object reference not set to instance of an object" exeption on _liveDatabaseFileName because parameters fetched from the config comes out empty. ("Enumeration yielded no results".)

Again, this might not be EPiServer related at all, but if anyone has any hints on where I should start looking, that would be greatly appreciated. (I was unable to find any release information from MaxMind, although I didn't look too hard.)

Sep 12, 2017 10:55

Okay so I managed to get through the first hurdle, changing the code in the job to

_liveDatabaseFileName = Web.VirtualPathUtilityEx.RebasePhysicalPath(System.Configuration.ConfigurationManager.AppSettings["databaseFileName"]);

and instead adding to web.config

    <add key="databaseFileName" value="[appDataPath]\Geolocation\GeoLiteCity.dat" />

Now my next problem is that whatever user the application is using isn't allowed to access the TEMP folder on the server, which is where is stored. Sooo... next question, to the server techy: How is .NET/ EPiServer users set up with IIS on a Windows Server (2012)? Are this rights maintanable in the code, in config, or in IIS?

I know this isn't exactly EPiServer related so feel free to close this topic.

Sep 14, 2017 17:51

Okay, so I've found out that this job is an old default job probably going back to EPiServer 6, maybe even older. And it's not functionality we're using.

So, I'm marking this solved on "outdated default scheduled job that's probably no longer a part of EPi and I should probably just remove it".

Edited, Sep 22, 2017 14:56
<p>Hi I am expering similar issue, In an old project EpiServer 7.0.5**&nbsp;</p> <p>&lt;providers&gt;<br />&lt;add databaseFileName="[path]\Geolocation\GeoLiteCity.dat" name="maxmind" type="EPiServer.Personalization.Providers.MaxMind.GeolocationProvider, EPiServer.ApplicationModules" /&gt;<br />&lt;/providers&gt;</p> <p></p> <p>It seems like it doesnt read the GeoLiteCity.dat file from C:</p> <p></p> <p>Causing my location criteria in Personalisation/visitor group is not working.&nbsp;&nbsp;</p> <p></p> <p>Whereas on the new project, EPiserver 10.0 same code works</p> <p></p> <p>Any solution?</p>
Oct 05, 2017 16:26
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.