The type initializer for '' threw an exception.

Cause: Logging into the app on the device/simulator you see the above error. This is due to insufficient permissions on the AppServer files.

Resolution:   This is a permissions issue in IIS.

Here are the steps to give the users full control if you are using IIS 6.0:

  1. Launch IIS. 
  2. In the Connections pane, expand the Server under the Start Page.
  3. Expand Sites.
  4. Expand your Web Site and locate your Virtual Directory/Application.
  5. Determine which Application Pool the Virtual Directory is assigned to.  To do so, right click > Properties > Virtual Directory Tab. (Note which Application Pool is selected at the bottom)
  6. Navigate to the Application Pool, determined in step 2. 
  7. Highlight the Application Pool, right click, and click on the Identity Tab. Note which User Group is selected for "Predefined".
  8. The “Predefined” User Group selected in step 4 is the User you want to give "Full Control" on the SQLite Folder, and your virtual directory. 
  9. Add Network Service as a User Group and give Network Service Full Control similar as you to the above steps.

Here are the steps to give the users full control if you are using IIS 7:

1) Launch IIS 7. 
2) In the Connections pane, expand the Server under the Start Page. 
3) Expand Sites. 
4) Expand your Web Site, locate and select your Virtual Directory/Application. 
5) On the far right in the Actions pane, select Basic Settings. Note the Application Pool name (e.g. DefaultAppPool) from the resulting dialog window. 
6) Cancel out of that dialog window. 
7) Click on Application Pools in the Connections pane. A list of application pools should appear in the middle pane. 
8) Navigate to the Application Pool that was determined in step 5 and select it. 
9) In the Identity column, note the Identity name of the Application Pool. 
10) In the Connections pane, right-click over your Web Site and select 'Explore'. This will launch your AppServer directory (for example, <local>:\inetpub\wwwroot\). 
11) Right-click on the SQLite folder and select Properties. 
12) Select the Security tab. 
13) Click the Edit button. 
14) Click the Add button. 
15) In the 'Enter the Object Names to Select' field, type in the name of the application pool identity you obtained in step 9. 
16) Click the 'Check Names' button then OK to add it to the list of Group or User Names. 
17) In Group or User Names, select the application pool identity. 
18) In the permissions section, select Full Control, then Apply.
19) Repeat steps 14 through 18 to add NETWORK SERVICE to the Group or User Names and give it Full Control. 
20) Click Apply, then OK.

If the above steps do not resolve the error, consider the following:

In the event a database gets restored, the default platform can sometimes be pointed to none. Changing it back to default or adding the necessary account to the App Server directory, and restarting IIS, may resolve this error.

Additional resources:
Have more questions? Submit a request


  • 0

    I have found (on IIS 7) that if you are using the IIS AppPool\DefaultAppPool as the identity of your app pool, then you don't need to give NETWORK SERVICE any access to the SQLite folder or the entire virtual directory.

Please sign in to leave a comment.
Powered by Zendesk