Click to See Complete Forum and Search --> : Deploying a webservice to a web service


fogofogo
10-09-2007, 12:13 PM
Deploying a webservice to a web server

Hello all,

I'm new to the whole web services thing, and I'm having a few problems with it. I've built a web service using visual dev 2005, and it connects to a database and returns data using the code below...


<%@ WebService Language="C#" Class="Customers" %>

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;
using System.Data.SqlClient;

[WebService(Namespace = "asdasdasd")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Customers : System.Web.Services.WebService {

[WebMethod]
public DataSet GetCustomers() {
SqlConnection conn;
SqlDataAdapter myDataAdapter;
DataSet myDataset;
string cmdString = "Select * From John";

//conn = new SqlConnection("server=111.111.111.111;uid=blah;pwd=blah,1;database=blah");
conn = new SqlConnection("Data Source=222.222.222.222;Initial Catalog=blah; Persist Security Info=True; User ID=blah; Password=blah");
myDataAdapter = new SqlDataAdapter(cmdString, conn);

myDataset = new DataSet();
myDataAdapter.Fill(myDataset, "Customers");

return myDataset;
}

}



when I publish the site and upload it to the webserver, I get this erro message

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0117: 'System.Web.Services.WebServiceBindingAttribute' does not contain a definition for 'ConformsTo'

Does anyone know what I've done wrong? Or what I need to do to fix this problem?

Also has anyone come across any good tutorials the deal with updating and querying databases via web services?

Thanks for your time,

John

fogofogo
10-11-2007, 12:39 PM
resolved - server was set to 1.0 instead of 2.0 :p