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.
5 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
amrish kumarPosted Jul 23, 2015, 9:27 AM
I was passing int in parameter,
but when i passed the value in string it resolve the error.
amrish kumarPosted Jul 23, 2015, 7:25 AM
Manas MohapatraPosted Jul 23, 2015, 7:01 AM
amrish kumarPosted Jul 23, 2015, 6:56 AM
By My Service is worked when im using Get Method in Service.
But it Doesnt work when im trying to use post Method.
Manas MohapatraPosted Jul 23, 2015, 6:49 AM