[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1
{
[OperationContract]
public void DoWork()
{
return;
}
public List<Products> GetProducts()
{
List<Products> products = new List<Products>();
string connString = "Data Source=(Local);Initial Catalog=Products;User Id=pig;Password=123456;";
SqlConnection sqlConn = new SqlConnection(connString);
SqlDataAdapter thisAdapter = new SqlDataAdapter("select * from [Products].[dbo].[Products]", sqlConn);
DataSet thisDataSet = new DataSet();
thisAdapter.Fill(thisDataSet, "Products");
foreach (DataRow theRow in thisDataSet.Tables["Products"].Rows)
{
Products product = new Products();
product.Id = theRow["Id"].ToString();
product.Price = theRow["Price"].ToString();
products.Add(product);
}
return products;
}
}it shows a exception :
The remote server returned an error: NotFound.
what's wrong???