Back to list
Views:   4.9K
Replies:  1

Repository Error message - Type Initializer threw an exception.


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. 


Ryan Loughner, Dec 15, 2014
Reply 1
Figured this out. The issue occurred because I fat-fingered the database password. 
Ryan Loughner, Dec 15, 2014

Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas.      Vsn 1.3.0