Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't connect to local SQL Server
Message
De
31/08/2005 12:12:01
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Web Services
Titre:
Can't connect to local SQL Server
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Database:
MS SQL Server
Divers
Thread ID:
01045539
Message ID:
01045539
Vues:
66
Once again, the simplest of VS.Net tasks seems to be kicking my backside.

I'm trying to set up a simple web service that connects to a local SQL Server instance and the ever-popular Northwing database. The SERVICE1.asmx.cs is as follows:
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;

public class Suppliers: WebService
{
	private System.Data.SqlClient.SqlConnection sqlConnection1;

	private void InitializeComponent()
	{
		this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
		// 
		// sqlConnection1
		// 
		this.sqlConnection1.ConnectionString = "integrated security=SSPI;data source=\"(local)\";persist security info=False;initial catalog=Northwind";

	}

	[ WebMethod() ]
	public DataSet GetAllSuppliers()
	{
		
		SqlCommand cmd = new SqlCommand("select * from Suppliers", this.sqlConnection1);
		SqlDataAdapter adapter = new SqlDataAdapter(cmd);
		DataSet dsSuppliers = new DataSet();

		this.sqlConnection1.Open();
		adapter.Fill(dsSuppliers, "Suppliers");
		this.sqlConnection1.Close();

		return dsSuppliers;
	}
}
When I try to test the service, it appears to come to life with the default pages. However, I click the "invoke" button and get an HTTP 500 error. Stepping through the code, the error occurs when the connection object opens.
So, I'm guessing it is some kind of security issue, but I haven't a clue as to what. Teh Google, she no help.

I've tried this against a server that requires a UID and password, instead of Windows authentication, with the same result.

Anyone have any clues?
Dan LeClair
www.cyberwombat.com
SET RANT ON - The Wombat Blog

Life isn’t a morality contest and purity makes a poor shield. - J. Peter Mulhern
Disclaimer: The comments made here are only my OPINIONS on various aspects of VFP, SQL Server, VS.NET, systems development, or life in general, and my OPINIONS should not be construed to be the authoritative word on any subject. No warranties or degrees of veracity are expressed or implied. Void where prohibited. Side effects may included dizziness, spontaneous combustion, or unexplainable cravings for dark beer. Wash with like colors only, serve immediately for best flavor.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform