I am trying to add an object to my entity but it is giving me the error: "Not Found" here is my code:
DataServiceContext dtx = new DataServiceContext(new Uri("http://localhost/website2/wcfservice1.svc/"));
dtx.Credentials = System.Net.CredentialCache.DefaultCredentials;
ServiceReference1.Car car = new ServiceReference1.Car();
car.CarName = "aaa";
car.CarModel = "111";
dtx.AddObject("Car", car);
dtx.SaveChanges();
I have tried "Cars" and "Car" both in AddObject but still didnt help.. my CARID column is a PKEY column in database.
Please help. Thanks.
dtx.AddObject("Cars", car);is giving you the same error? And that error is a 404 from the server? Could you use a tool like Fiddler (or any other web traffic monitoring program) to see what the outgoing request URI (and payload) is? I would expect the URL to be/wcfservice1.svc/Cars, and I would also expect that if you go to that URL in a browser you shouldn't get a 404. Could you try that out? - Jen S