Since nobody replied, I figured out how to debug it and narrowed it down. The following generated line of code (from UserServiceBase.generated.cs) throws the exception:
private static SecurityContext<User> securityContext = new SecurityContext<User>();
System.IO.FileLoadException occurred
Message="Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Exception from HRESULT: 0x80131052"
Source="Access2Net.Services"
FileName="Microsoft.Practices.EnterpriseLibrary.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
FusionLog=""
StackTrace:
at Access2Net.Services.SecurityContext`1..ctor()
at Access2Net.Services.UserServiceBase..cctor() in C:\_Projects\Access2Net\App\Access2Net.Services\UserServiceBase.generated.cs:line 77
'Microsoft.Practices.EnterpriseLibrary.Security.dll is in bin folder and no problems occur at runtime.
I'm stuck. Any ideas? BTW, I'm using custom role based security provider, configured in web.config, could it be somehow related?