Type initializer for AsI.Security.SecurityContext threw an exception

this is for 15.0.  Why would this error occur?  What needs to be in place to successfullly call Asi.Security.SecurityContext.ImpersonateAnonymous() ???

(on another note the Release/Version drop down box in the screen I used to create this post does not contain 15.x versions.)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

You probably don't have the

You probably don't have the following setting in the iMIS/SystemParams section of your app's config file (or it refers to a user that doesn't exist or is disabled):

<add key="Authenticate.Anonymous.UserId" value="GUEST"/>

The value may need to be MANAGER instead depending on whether you're on 15.0.1 or 15.0.3 (I believe it's GUEST in 15.0.3 and all later versions). You can copy the iMIS/SystemParams section from an installed app server's web.config if you are unsure. It's also possible that you're missing one of Asi.dll's dependencies (typically Asi.Lexicon.dll and log4net.dll; both of these need to be in the same directory as Asi.dll) or that the connection string is missing or incorrect in the .config file.

Eric Means
System Architect, ASI


Hi All

Hi All

The system cannot find the file specified


I am getting below error after upgrading to newer version of IMIS 15.2, i copied all the latest version dlls , and tried all the steps above with no luck.

As the below exception does not say which file is missing, is there any resolution for this, or a way to find which file is missing?


Exception: System.TypeInitializationException
Message: The type initializer for 'Asi.Security.SecurityContext' threw an exception.
Source: Asi
   at Asi.Security.SecurityContext.LogonByUserId(String userId)
   at Asi.iBO.ContactManagement.CContactUser.LoginByUserId(CContactUser contactUser, String userId)
   at Asi.iBO.ContactManagement.CContactUser.LoginByWebLogin(String webLogin, Boolean setAppPrincipal)
   at Anzca.Web.Controllers.Common.LoginController.LogIn(LogOnModel model, String returnUrl) in Projects

Nested Exception

Exception: System.IO.FileNotFoundException
Message: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
Source: mscorlib
   at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
   at System.Reflection.Assembly.LoadFile(String path)
   at Asi.Utilities.PlatformResolver.LoadAssembly()
   at Asi.Utilities.PlatformResolver.EnsureTypeMap()
   at Asi.Utilities.PlatformResolver.Resolve[T](Object[] constructorArguments)
   at Asi.Security.SecurityContext..cctor()


Is this file in place?  It's a new component.


Hi Henry,

It works like a charm, Is there any documentation available in regards to upgrade of 15.2 which specifies this.