Question About Some Code (1 Viewer)

jcruzAME

Registered User.
Local time
Today, 06:21
Joined
Oct 5, 2011
Messages
135
Looks like we're running V7.
 

AccessMSSQL

Seasoned Programmer-ette
Local time
Today, 04:21
Joined
May 3, 2012
Messages
636
Here's a couple of articles that might help. IIS 6.0 is more straight forward because you can locate the IUSER account easily from a networked SQL server. But in IIS7 it appears to be not as intuitive.

http://stackoverflow.com/questions/454497/iis7-sql-2008-and-asp-net-mvc-security

http://stackoverflow.com/questions/1933134/add-iis-7-apppool-identities-as-sql-server-logons

http://www.iis.net/learn/manage/configuring-security/application-pool-identities

http://stackoverflow.com/questions/...-failed-for-user-nt-authority-network-service

I couldn't find any clearly written articles on this but I think this might be the direction you need to go. IIS 6.0 was simpler.
 

jcruzAME

Registered User.
Local time
Today, 06:21
Joined
Oct 5, 2011
Messages
135
This does not work when your SQL Server is on a different machine than IIS – rboarman Aug 21 at 20:15

Correct. If it isn't, and if you are not in an active directory, then you have to create a user account on the server hosting your SQL. If you use SQL authentication, then you can create a simple SQL account. If not, you can use a windows account with the same username and password as the user account that the website is running under, but the website has to be running as a user with "Login as a Service" permissions

Do you know what they mean by that last part? Login as a Service permissions?
 

jcruzAME

Registered User.
Local time
Today, 06:21
Joined
Oct 5, 2011
Messages
135
I just looked up some stuff on that part, but no one ever mentions which user this needs to be set as. The user on the Web Server or the one on the SQL Server? Do you know?

EDIT: I just checked and it is set for the user on the web server. I'm at a complete loss here as to why the site can't open a connection to the SQL Server. Every piece of troubleshooting I come across I find out it's already been done.
 

jcruzAME

Registered User.
Local time
Today, 06:21
Joined
Oct 5, 2011
Messages
135
I just found that thread as well. I checked and the web server user has that enabled.
 

AccessMSSQL

Seasoned Programmer-ette
Local time
Today, 04:21
Joined
May 3, 2012
Messages
636
hmmmm...are you guys using AD?

did you try creating odbc from the webserver yet?
 

jcruzAME

Registered User.
Local time
Today, 06:21
Joined
Oct 5, 2011
Messages
135
What is AD?

Yes, I responded a few posts ago that I had created an ODBC connection without a problem.
 

AccessMSSQL

Seasoned Programmer-ette
Local time
Today, 04:21
Joined
May 3, 2012
Messages
636
I'm at a loss at this point. You could try one more thing - login to the SQL Server machine with the windows domain account you are logging in with when you test and experience the error. Then try to connect to the SQL Server. Also, in the web.config your connectionstring is referencing the IP address of the SQL Server? Maybe you need to put the actual name in?
 

jcruzAME

Registered User.
Local time
Today, 06:21
Joined
Oct 5, 2011
Messages
135
Join the club! I think we've tried to put in the server name and it didn't work. I will try that again.
 

AccessMSSQL

Seasoned Programmer-ette
Local time
Today, 04:21
Joined
May 3, 2012
Messages
636
Here's how one of my connection strings are setup - maybe take a look and see if you need to change yours?
Code:
<add name="MyConn" connectionString="Data Source=SQLServer;Initial Catalog=MyWebsiteDatabase;Persist Security Info=True; User ID=webuser;Password=webpassword;MultipleActiveResultSets=True"
      providerName="System.Data.SqlClient" />

I see your connection string doesn't have providerName and the database reference you have is server=. Try modify to the above format?
 

jcruzAME

Registered User.
Local time
Today, 06:21
Joined
Oct 5, 2011
Messages
135
Changed the format and added providerName, still get the error.
 

AccessMSSQL

Seasoned Programmer-ette
Local time
Today, 04:21
Joined
May 3, 2012
Messages
636
Are you sure named pipes is set up properly on SQL Server. Here's a screenshot that shows if it is or not. Not sure if you are verifying this stuff yourself or if your Server guy is just telling you it is?? You need to go to SQL Server Configuration Manager to set this up.
 

Attachments

  • SQLServerConfigurationManager.jpg
    SQLServerConfigurationManager.jpg
    35.2 KB · Views: 232

AccessMSSQL

Seasoned Programmer-ette
Local time
Today, 04:21
Joined
May 3, 2012
Messages
636
Also, what version of SQL Server are you running? Guess that might help also.
 

jcruzAME

Registered User.
Local time
Today, 06:21
Joined
Oct 5, 2011
Messages
135
SQL 2012. I will double check but I'm pretty sure I checked the other day and it was enabled.
 

AccessMSSQL

Seasoned Programmer-ette
Local time
Today, 04:21
Joined
May 3, 2012
Messages
636
Oh...okay. Haven't used SQL 2012 yet. Yikes. So not sure what the issue could be. Have you tried just temporarily turning off windows firewall on that macihne and testing again?
 

jcruzAME

Registered User.
Local time
Today, 06:21
Joined
Oct 5, 2011
Messages
135
Haven't tried that but I know the network guys have opened the ports necessary for them to communicate.
 

Users who are viewing this thread

Top Bottom