Home  /  Questions  /  Question



50   50
Dec 15, 2014


Repository Error message - Type Initializer threw an exception.

Hello, 

I was wondering if anyone has come across the following error message. I receive the error message, "The type initializer for 'xxxxx.Domain.Repository '1' threw an exception". The error occurs when I run the following code: 

var allLocations = db.TblProjectLocations.All();

When I test this locally (with a mdf database file), I don't receive this error message and everything works fine. This error started to occur when I began testing my code on the web server. 

Here's my connection string as it appears in the web.config: 
<add name="Project" providerName="System.Data.SqlClient" connectionString="Data Source=dbServer;Initial Catalog=DatabaseApps;Persist Security Info=True;User ID=userId;Password=secret"/>

Any assistance would be greatly appreciated. 

Regards, 

Ryan 



50   50
Dec 15, 2014
Figured this out. The issue occurred because I fat-fingered the database password. 
 1 comment
 
Thanks for reporting back --- Jack Poorte  Dec 16, 2014