473,785 Members | 2,858 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# Web Service won't connect to database

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.Op en();
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

Feb 7 '07 #1
1 7198
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 -

"Nelson André" <Ne********@dis cussions.micros oft.comwrote in message
news:B5******** *************** ***********@mic rosoft.com...
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.Op en();
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

Feb 11 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2357
by: PF | last post by:
On one of our machines, all of the SQL Server 2000 components except for the main Server component (SQL Server core) itself were installed (Management tools, etc) a while ago and everything was running fine. Now I go and add/install the Server component and then Service Pack 3a. It seems that Service Manager won't start up (I get an hourglass cursor) and now I find that Enterprise Manager won't run as well. No error messages appeared...
10
1912
by: amirmira | last post by:
I have a Windows Service developed in VB.NET that attempts to connect to a database as soon as the service starts. I have no problem when I start the service manually - but when I restart the computer that hosts the service, I get a Null Reference Exception when I try to connect to the database (I have set the service to start automatically). Any ideas why this is happening? Thanks in advance. Ajay Mirmira
3
5583
by: adasilva | last post by:
I have create a Windows service that uses a timer to access a Web Service. The service is set to start Automatically and its using the local system account. The service also logs events to the event viewer and the Event viewer is set to overwrite events as needed. The problem is that when I boot the PC the service does not start and I got two error messages in the System log: (Event 7000. The <MyService> service failed to start due to the...
8
55682
by: Kevin D. | last post by:
Please note, I already posted this on the MySQL official forum, but received no response. I thought I'd try again in another location. My apologies to anyone reading this twice... Despite everything I've tried, I cannot get MySQL to start as a Windows service. However, I AM able to get it started via the mysqld-nt --console command. Here is my (funky) setup:
3
13806
by: =?Utf-8?B?RGFuZGFuIFpoYW5n?= | last post by:
Now I have a web application, a web service and a SQL Server database. The Web application will invoke the web service, the web service invokes the SQL Server stored procedure. I let the web service run in an application pool which runs under a domain user, this domain user has permissions of accessing database and the connection to database is trusted connection. All these work well. The web application will be used in internet (not...
15
13516
by: Joseph Geretz | last post by:
I'm a bit puzzled by the current recommendation not to send Datasets or Datatables between application tiers. http://support.microsoft.com/kb/306134 http://msdn2.microsoft.com/en-us/library/ms996381.aspx Formerly, with classic Microsoft DNA architecture, the ADO Recordset was a primary transport medium, recommended for transmitting data between application tiers. In fact, there are whole books written on the subject.
5
38836
by: mivey4 | last post by:
Hi, First off, I am aware that this is a very heavily documented error and I have done my homework for throughly researching probable causes before deciding to post my problem here. At this point, I believe another set of eyes on the issue is merited. I am a MSSQL DBA and somewhat new to ORACLE; but I have read the administrators manual having a basic thorough level of knowledge (Tho' I am still learning) and understanding of how to...
8
14312
by: =?Utf-8?B?RGF2aWQrKw==?= | last post by:
Hi, I have been developing Web Services in VS2005. Usually I use the built in server in VS2005 to test and develop the Web Service. However I now want to make this Web Service available to other computers (and applications) in our local company network. When the service runs it accesses an Oracle database and pulls some data out. It works fine when running in VS2005 server. To allow the Web Service to
9
1620
by: Ryan Liu | last post by:
Hi, I use C# wrote an Client/Server application. In production environment, will be 130 clients (Windows XP) connect to a Server (Windows 2000/2003 Server) thought TCP/IP socket in a local 100M LAN. "Server" is running as a Windows service. The is one thread running for one clinet in the server. Sometime the user tells me the Sever will be slow after it runs for 1-2 days.
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.