I have a server with a SQL Server 2012 Express database. I am authenticated to connect to it and am using it as the backend for an ASP.NET MVC 4 application.
With this application I'm also developing an API. Calling the API programmatically using jQuery within my own application works fine. Querying the database to get the information works as well.
However, when I run the application from VS2010 and try accessing the API by using a URL that would access the database, I get an HTTP 500 Error.
Just to make sure this issue isn't on my application's end, I then modified the API resource so it gets a local array (instead of information from the database) and when I hit the same URL, it returned the information in XML form on the localhost page.
The problem seems to be that the URL call to the API attempts to connect to the database not as the authenticated user (me), but from the browser.
How can I configure SQL Server to allow a URL call to the API in the browser to access the database and return the data in JSON/XML form? (eg. like you can do with the Twitter REST API)
UPDATE: Debugging output on HTTP Request:
Request URL:http://localhost:5555/api/Performance/ShowMachines
Request Method:GET
Status Code:500 Internal Server Error
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Host:localhost:5555
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11
Response Headersview source
Cache-Control:private
Connection:Close
Content-Length:0
Date:Thu, 02 Aug 2012 16:40:11 GMT
Server:ASP.NET Development Server/10.0.0.0
X-AspNet-Version:4.0.30319