SQl server doesn't exist or access denied when accessing SQL server from localhost webmethod

Posted on 2007-10-04
Last Modified: 2008-01-10

I have a web service which works fine and is deployed to the server.  The web service accesses database on another server and returns data to the client.  I can run the client code (c# winforms) to connect to the web service on the server and everything is peachy.  I change the client to point to localhost (I have setup virtual dir etc) because I want to debug it.  I can debug but on calling the stored procedure I get "SQL Server is not available or access is denied" I can connect to that SQL server via Visual Studio no problem.  The client code is the same, the login info to the DB server is the same (the connection string is read from web.config)!!  I tried SQL profiler but the call actually doesn't make it that far.  All I can think of is that the issue is to do with the my local machine, probably IIS but I am not sure what.  Any ideas?

Question by:gbzhhu
    LVL 16

    Expert Comment

    Is your connection string using integrated security or a specific username/pw for the database connection?
    LVL 12

    Author Comment

    specific username/pw

    I know the connection string works because the following is my client code - the web service proxy constructor.  I comment one of the l;ines depending if I want to use the server web service or the localhost web service.  The second line works ok and the first doesn't.

            public CropBenchService() {
          this.Url = "http://localhost/CropBenchCalc/CropBenchService.asmx";
          //this.Url = "";
    LVL 12

    Author Comment


    The above M$ site contains an exe that checks MDAC version.  I run it on the client PC and I get version 2.8 sp2 on Windows XP sp2.  I then run it on the server and I get version 2.8 RTM.  The server is Windows Server 2003 standard edition.  The article, however, doesn't tell me how to tell if there is MDAC mismatch.

    Anybody think the issue is MDAC?

    LVL 1

    Accepted Solution

    Assuming that you use MSSQL2005, try next:
    Start->MSSQL2005->Configuration Tools->Surface Area Configuration
    Database Engine
    Remote Connections
    check Local and remote Connections
    check Using TCP/IP only

    If you are using MSSQL 2000 this option is somwhere in Tools.

    I hope this help.
    LVL 12

    Author Comment

    Thanks nyky99,

    I will try what you suggested.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Viewers will learn how the fundamental information of how to create a table.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now