473,699 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL server access denied from web service

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.ConnectionS tring =
ConfigurationSe ttings.AppSetti ngs["connectstr ing"].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
Nov 23 '05 #1
5 2401
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

Nov 23 '05 #2
Minus the actual values, it looks like this:
"Data Source=serverna me;User ID=u;Password=p ;Initial Catalog=c;Persi st
Security Info=True;"
Nov 23 '05 #3
Are you using the same config file in both circumstances?

Nov 23 '05 #4
As suspected, it was a permissions issue. Fixing it involved using
impersonation as described by MS at:

http://msdn.microsoft.com/library/de...SecNetHT01.asp
Nov 23 '05 #5

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.

D Godwin wrote:
*I am running a web service on my local machine (using standar
VS.NET test
pages) that is attempting to access a SQL database on a networ
server. C#
code looks something like this:

[WebMethod]
public string GetSomething()
{
SqlConnection con = new SqlConnection() ;
con.ConnectionS tring =
ConfigurationSe ttings.AppSetti ngs["connectstr ing"].ToString();
con.Open();
....
}

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

Thanks in advance.
David

-
jimskippe
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message1431533.htm

Nov 23 '05 #6

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

Similar topics

5
310
by: Martin Robins | last post by:
I have never dabbled with ASP.NET until now so be warned! I have created a web application with the single default form: WebForm1.aspx and when I try to display it I get this error. My understanding was that ASP.NET was supposed to set itself up, especially as I am using Windows Server 2003. Can anybody give me instruction as to resolution; what folder should I be granting the access to? The path shown only exists as far as the...
2
2216
by: Ross | last post by:
Hi I have an application using asp.net that I am running on my PC. The web form has a text box where you can enter a name for a new Photo category then click on the button. The code is intended to create a new directory under Photos such as "Relatives".
12
1314
by: RKay | last post by:
I have a Win2k server running SQL Server 2000. On that box I built a working web service that pulls data from the database. One of the services available simply accepts an ado.net connection string to test if a connection can be made to the local server. I can call that web service from any box on my network, and with the correct connection string, I can establish a connection to the database. However, when I copy the exact same service...
5
1975
by: Dan Lorenz | last post by:
When trying to use the function CreateDirectory on my local machine everything works fine but when I upload the page to my webhost I get an issue that it can't find path on D:\, though D:\ is what my website is found on. This is an H-SPHERE web cluster host. From my research I found that this issue is due to ASPNET account not having read previdgeles on the root of the drive. My question is what is the correct approach to solve this...
0
2262
by: Joergen Bech | last post by:
Fairly new to ASP.NET 1.1. Getting the error below when running application on a web server outside of my control, but only the first time I run it: 1. After a long period of inactivity (or updating the code-behind dll) accessing any aspx page in the application causes the application to run for the first time. Some of the initialization involves reading and writing some text and xml files using simple streamreader and streamwriter...
1
4887
by: Jody Gelowitz | last post by:
We are having an issue in that when trying to read a file that is on Server2 from Server1 (through our ASP.NET project), we receive the error: Access to the path "\\Server2\MyShare\MyFile.tif" is denied. Here is the server setup that we have: Dev - Development Computer on WinXP Pro SP2 (IIS5), VS2003 developing under .NET Framework 1.1 Server1 - Web Server on Win2003 Server (IIS6) Server2 - File Server on Win2003 Server
3
8003
by: Shailesh Humbad | last post by:
I figured out what was causing the "Access is Denied" error when calling functions from referenced DLLs in my service. I've tried to be very detailed, so bear with me. It turns out that libraries I made myself were not having this problem, but it only happened with a zip library I downloaded and copied into my program's directory. When using classes from this library, my service threw an "Access Is Denied" FileLoadException, which...
1
2046
by: lecnac | last post by:
Sorry for the repost. I must have done something wrong when I tried to post my reply (I can't seem to find it). Anyway, I'd really appreciate any help that anyone could provide. My issue is quickly becoming more and more urgent. Thanks for the thoughts Bruce. However, we can't do #1 (we must use Integrated Windows Authentication). And, can't do #2 (the server will be,
3
5421
by: Simon | last post by:
Hi All, I'm hoping someone will have some words of wisdom for me regarding MS Clustering on Windows 2003. I have a service that runs on a cluster. During invocation it's supposed to determine from the cluster which node is active (this is a active/standby configuration) and either proceed or sleep depending on the status. The interface to the cluster is that advertised by the standard interop layer built by Visual Studio for the...
0
8689
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
8618
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
9178
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8885
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7752
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6534
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
5875
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
4376
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
3058
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

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.