[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 988
  • Last Modified:

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


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?

  • 3
1 Solution
Is your connection string using integrated security or a specific username/pw for the database connection?
gbzhhuAuthor Commented:
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 = "http://myserver.com/CropBenchCalc/CropBenchService.asmx";
gbzhhuAuthor Commented:

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?

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.
gbzhhuAuthor Commented:
Thanks nyky99,

I will try what you suggested.

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now