August 24, 2006 at 9:21 am
I just got VS .Net and I'm trying a walk thru program that connects to Sql Server. I have used the generated connection string and I have tried my own, but every time I try to launch the web page I get an error to the effect of that the server doesn't exist or access is denied. (There is no problem with my account.) This is only happening when it is accessing the server through a web page.
Could there be something in sql server that is denying access from web pages.
Any ideas are welcome.
fryere
August 25, 2006 at 1:19 am
More than likely you're connecting using integrated security and the user context under which the web page is running is either invalid/null (the "double hop" scenario) or doesn't have access itself to the database.
You will need to post more info re: machine setup, connection string, development environment etc.
August 25, 2006 at 6:11 am
Connection String that is generated:
workstation id=xxxxxxx;packet size=4096;integrated security=SSPI;data source=ServerName;persist security info=False;initial catalog=Test_Database
I have tried this with VB.Net & C# (Visual Studio 2003). I have also tried connecting by IP and by a specific account. I have also tried connecting to a database on my computer and to a server.
I now think the problem is not on the sql server side since a web developer is accessing the server without problems using Visual Studio 2003.
This has been very frustrating since I feel that this should be a simple task to accomplish.
"and the user context under which the web page is running is either invalid/null (the "double hop" scenario) or doesn't have access itself to the database."
Could you explain this statement a little more. I am an extreme novice in this.
Thanks and let me know if you need any thing else.
fryere
August 25, 2006 at 6:26 am
Okay, this is a bit tricky remotely but here goes.
Firstly, are you connecting to a SQL 2000 or SQL 2005 database ? If it's 2005 remote connections can be disabled.
You say you're developing a web page in VS 2003 (.Net 1.1 I presume) and that when you try to open the connection it says server does not exist or access denied. Can you log on to the server using query analyzer using integrated security ? Are you sure your account can login using integrated security ?
Check the Directory Security settings in IIS on the web server you're running. Is Integrated Security switched on ?
Check your authentication mode in your web.config file. Are you using Windows and impersonating the calling account ?
The "double hop" occurs when your browser, web server and database server are on different machines. There are many articles you can google for that explain this in a lot more detail but basically as a security measure the windows credentials you supply from the browser to the web server are not then passed on again to the database server. The error message to expect when this occurs in something like "login failed for user (null)".
Give these things a look at and see how you get on.
August 25, 2006 at 7:08 am
I doubled checked and tested connecting w/ Query Analyzer successfully.
.Net 1.1 & SQL 2000
server does not exist or access denied. (This is the error)
IIS: Intergrated Windows Authencation is checked. I also changed Anonymous Account to my Windows Account(which is a dbo). The Authenicated Access section is blank.
I did try editing my Config file and added the impersonate info, but got other errors. (I think this was the point that I gave up, so I can try it again and post the errors) This may be a stupid question but do you mind to explain why this is needed. It seems like all you would need is the connection string.
Thanks again for the response. I would really like to get this solved.
fryere
August 25, 2006 at 8:04 am
Sorry then but my best suggestion would be starting the walkthrough from the beginning in a fresh project. Compare your settings with the other developers that's working including service accounts, database user accounts, connection strings etc etc
Without being at your machine it's difficult to know what else to look at.
Sorry
August 25, 2006 at 9:03 am
Ok, I changed the anonymous access back to the default: IUSER_Workstation and then added this account to sql server.
This is the message I get now:
An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider,
error: 40 - Could not open a connection to SQL Server)
However, I am not running SQL 2005.
fryere
August 25, 2006 at 11:57 am
Btw, I finally got it to connect. I added the Identity line in Web Config to Inpersonate my network logon, and set the ISS Anynomous Access account = my network logon.
Thanks for the help.
fryere
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply