Note that there are some explanatory texts on larger screens.

plurals
  1. POInternal Server error while consuming rest service in C#
    primarykey
    data
    text
    <p>I am bit new in rest service </p> <p>I have service as below <code></p> <pre><code> [OperationContract] [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped,UriTemplate="AuthenticateJSON/?username=username&amp;password=password")] public Response.Authenicate Authenticate(string username,string password) { var returnObject = new Authenicate(); try { returnObject.Response = "True"; } catch (Exception exceptionObject) { returnObject.IsError = true; returnObject.ErrorMessage = exceptionObject.Message; } return returnObject; } </code></pre> <p></code></p> <p>And I consume Service by below code </p> <p><code></p> <pre><code> string input = @"{'himanshu','password'}"; var newUser = new User(); newUser.username = "username"; newUser.password = "username"; var input = new JavaScriptSerializer().Serialize(newUser); var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://localhost:20620/Services/User/OperationActiveDirectory.svc/AuthenticateJSON/?username=username&amp;password=password"); httpWebRequest.ContentType = "text/json"; httpWebRequest.Method = "POST";//POST/GET string responseText = ""; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { streamWriter.Write(input);//any parameter } var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { responseText = streamReader.ReadToEnd(); } </code></pre> <p></code></p> <p>but i am facing below error while execution<img src="https://i.stack.imgur.com/yRwe7.png" alt="enter image description here"></p> <p>Could some one suggest me what i am doing wrong here</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload