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 / February 2007

Tip: Looking for answers? Try searching our database.

C# Web Service won't connect to database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nelson André - 07 Feb 2007 14:26 GMT
Dear friends,
I'm a Web Services newbie and I have created a simple Web Service that given
3 parameters accesses a database and returns 1 value.
When run from Visual Studio 2005, the Webservice returns the correct
information from the database with no problems.
I have created a new Virtual Directory in my local IIS that points to the
VS2005 folder where the Web Service is.
When I run the Web Service from the browser like
http://localhost/wsfolder/webservice.asmx and then insert the 3 parameters,
after clicking INVOKE I always get the "Can't connect to database" that I
have created with a try/catch block for myConnection.Open();
I have my username and password for the SQL server in the code's connection
string.
Then I have created a simple c# Form application that consumes the Web
Service and get the same error of course.
What am I forgeting?
Thanks in advance,
Nelson
Joseph Geretz - 11 Feb 2007 18:25 GMT
Hi Nelson,

This sounds like it might be a user identity issue. When running in the IDE,
your database access is probably using your interactive user credentials.
However, when running from IIS, depending on your security settings on the
virtual directory, the aspx script may be running under the credentials of
the generic user which is used to serve anonymous requests. If this user
doesn't have access to the database, then you're going to have problems.

I'm not familiar with your environment of course, so this is just an
educated guess. But this would be the first thing I'd be looking at.

Hope this helps,

- Joseph Geretz -

> Dear friends,
> I'm a Web Services newbie and I have created a simple Web Service that
[quoted text clipped - 17 lines]
> Thanks in advance,
> Nelson

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.