amrish kumar

amrish kumar

  • NA
  • 96
  • 3.7k

Problems in cosuming wcf Restful Service

Jul 23 2015 6:39 AM
When Ever im trying to consume  my wcf restful service with Post Method it gives Exception

The remote server returned an error: (404) Not Found. 

But when i use Get Method in service it works  fine.
 
  Service
 
[OperationContract]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped,  Method = "POST", ResponseFormat = WebMessageFormat.Json, UriTemplate = "UserLogin/{emailId}/{password}")]
int UserLogin(string emailId, string password);
 
  
 
This is client application
 
var request = (HttpWebRequest)WebRequest.Create("http://localhost/GMTSService/GMTSService.svc/UserLogin/" + "user1"+ "passowrd");
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
Stream strm = response.GetResponseStream();
StreamReader strmReader = new StreamReader(strm);
string txt = strmReader.ReadToEnd();
Response.Write(txt);
 
 
 Please Help me to resolve this.
 
 

Answers (5)