ASP.NET Application SQL database will only work on localhost

I have an ASP application that uses SQL Databases from Visual Studio. Everything works perfectly if the application is run on the localhost virtual server, but when put on a real server I get an ambiguous “Server Error” message whenever a page is loaded that uses the database.