13120

change web application authentication to use Windows Authentication

Question:

I'm trying to publish my web application on IIS 8.5, but I'm getting this error when the application tries to retrieve data from the SQL Server 2008.

InnerException: {Message:An error has occurred., ExceptionMessage:Login failed for user 'domainname\WES-JXC2J02$'.,…} ExceptionMessage: "Login failed for user 'domainname\WES-JXC2J02$'."

The SQL Server doesn't have WES-JXC2J02$ listed as the authorized user because it's my dev machine name. If I try to add the machine name as user in SQL Server it gives me an error because there's no such user in the domain. I want to use Windows Authentication which is set to enable in IIS. What can I do to fix it?

Answer1:

So, apparently, as @MikeCheel said, it was forwarding my machine credentials to the SQL Server to retrieve the data from the database. Turned out, I needed to create a new login in SQL Server with limited access, then add the user id and password in the connectionString. I learnt it the hard way that SQL Server must have SQL and Windows Authentication enabled. Once that was configured, connection was setup and the data displayed properly.

Recommend

  • What's happened to my directory on GitHub?
  • Breeze webapi controller 'cannot support querying' over DbSet error
  • Multiple IHttpActionResults GET's within a single ApiController fail
  • Extract domain from link
  • Difference between Exception and SQLException
  • How to escape “?” using regex in .htaccess for mod_rewrite
  • Dynamically Impersonate a remote user - c# and asp.net
  • htaccess regex directory to variable
  • Postgresql “no pg_hba.conf entry” error
  • Cloud Functions for Firebase with custom HTTP path
  • something very wrong with SESSIONS
  • ERROR for site owner: Invalid site key
  • Objective-C : getting error on console while trying to display app on ipad device?
  • VirtualDocumentRoot handling non-existent folders
  • nginx prod setup for Clojure WebSocket app
  • Accessing Windows Azure Queues from client side javascript/jquery
  • Weighted round robin dns between 2 Cloudfront distributions
  • proxy request in node.js / express
  • Unity registration fails after iisreset
  • PHP Copy function not working
  • jwtBearer bearer token with rc-1 update to ASP.Net 5
  • Problems installing Yesod for Haskell
  • Unable to install Git-core+svn by MacPorts
  • Should I or shouldn't I use the CachingConnectionFactory with hornetq 2.4.1
  • Email verification using google app script and google forms
  • VSO Build — Response status code does not indicate success: 404 (Not Found)
  • Django rest serializer Breaks when data exists
  • Recording logins for password protected directories
  • ilmerge with a PFX file
  • Is there any way to access browser form field suggestions from JavaScript?
  • javaw.exe and eclipse startup problems
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • Getting error when using KSoap library to consume .NET web services
  • How do you join a server to an Active Directory (domain)?
  • Android Google Maps API OnLocationChanged only called once
  • Authorize attributes not working in MVC 4
  • Busy indicator not showing up in wpf window [duplicate]
  • UserPrincipal.Current returns apppool on IIS
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF