Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / May 2005

Tip: Looking for answers? Try searching our database.

SQL server access denied from web service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
D Godwin - 17 Feb 2005 16:10 GMT
I am running a web service on my local machine (using standard VS.NET test
pages) that is attempting to access a SQL database on a network server.  C#
code looks something like this:

[WebMethod]
public string GetSomething()
{
 SqlConnection con = new SqlConnection();
 con.ConnectionString =
ConfigurationSettings.AppSettings["connectstring"].ToString();
 con.Open();
 ...
}

The problem is that the Open() statement always yields a "SQL Server does
not exist or access denied" message.  The same code works fine when run from
a WinForms app, so I know that my connection string is good.  Is this a
permissions issue or am I missing a setting somewhere?

Thanks in advance.
David
Keenan Newton - 17 Feb 2005 17:12 GMT
Can we see the conenction string as it looks inside the config file.
Also if you are using a trusted connection, it is quite possible the
ASP.Net web service does not have the proper rights to the sql server
D Godwin - 17 Feb 2005 18:08 GMT
Minus the actual values, it looks like this:
 "Data Source=servername;User ID=u;Password=p;Initial Catalog=c;Persist
Security Info=True;"
Keenan Newton - 17 Feb 2005 21:17 GMT
Are you using the same config file in both circumstances?
D Godwin - 18 Feb 2005 18:31 GMT
As suspected, it was a permissions issue.  Fixing it involved using
impersonation as described by MS at:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/S
ecNetHT01.asp

jimskipper - 03 May 2005 16:04 GMT
I have the exact same problem with a VB.NET Web Service.

Identical code in a WinForms app succeeds, but the web service fail
with "SQL Server does
not exist or access denied." with the service on my local computer o
on our IIS server.

> *I am running a web service on my local machine (using standar
> VS.NET test
[quoted text clipped - 22 lines]
> Thanks in advance.
> David

-
jimskippe


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.