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();
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.comSET RANT ON - The Wombat BlogLife isn’t a morality contest and purity makes a poor shield. - J. Peter MulhernDisclaimer: 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.