So I've been working on an MVC app that pulls data from an existing database. I designed this as an 'Intranet Application' so that users would automatically be logged on to the app using their Windows credentials. This works, since the property @User.Identity.Name returns my Windows login name. (as well as other users), and they have access to the application itself. HOWEVER, when trying to access the database the information is on, I get the following error:
[SqlException (0x80131904): Login failed for user '**My computer name**'.]
It would appear that it's recognizing my windows login, but for some reason trying to use my machine name to access the database instead. At the company, this particular database is also accessed using employees' windows usernames, so I'd rather people be able to automatically access it using the built-in windows authentication in the MVC app.
In my web.config, I have identity impersonate set to false, authentication mode equal to Windows and the following keys in appSettings:
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="enableSimpleMembership" value="false"/>
<add key="autoFormsAuthentication" value="false" />
The connection strings were auto-generated for me, and the information IS retrievable when running the app from Visual Studio, so I can only assume it's an issue with IIS settings. (I've never deployed an MVC app before)
On the application's IIS settings I have every authentication disabled except for Windows Authentication. Any ideas what I'm doing wrong? Let me know if there's any additional information you need as well.