1

I've been struggling for some days now with quite a strange problem. I registered some Automapper mappings in a static class like so:

public static class AutomapperConfig
{
    public static void Configure()
    {
        Mapper.CreateMap<Person, EditPersonViewModel>();
        Mapper.CreateMap<User, EditUserViewModel>();
    }
}

This class itself is called from application_start in global.asax. So far so good, because in my development environment everything works fine.

In our production environment we are experiencing some behaviour which we cannot explain. After some time the application starts throwing these exceptions:

Missing type map configuration or unsupported mapping

which is quite strange, because the mapping exists alright. The quick fix to repair this is to recycle the application pool, which in turn causes application_start to be run again.

We suspect something goes wrong after the application is restarted after an application pool idle timeout. But unfortunately we cannot reproduce the issue with decreasing the IIS idle timeout.

By the way, we have already ruled out some other possible causes:

  1. the AutomapperConfig class was not static
  2. we were using some Autofac stuff to register the Automapper maps, but since we figured this maybe an issue, we removed the Autofac part

Any thoughts on the cause for this problem?

RickL
  • 3,318
  • 10
  • 38
  • 39

0 Answers0