.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

WCF WebInvoke + IsOneWay

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :WCF

We're having some strange issues when using the WebHttpBinding / WebInvoke and OneWay contracts (.NET 4.0). Without the "IsOneWay=true", everything is working great, but as soon as the one-way attribute is added, the WCF client always throws the following protocol exception:

The one-way operation returned a non -null message with Action ="

However, the interesting part is that invoking the service via Fiddler's request builder, the service responds correctly (returning a 202 instead of a 200). Is there some magic required to call one-way web methods from WCF clients, or is this a known issue?


View Complete Post

More Related Resource Links

webinvoke method=Post..throws error "The remote server returned an error: (405) Method Not Allowed."



my service defn

      UriTemplate = "/CreateCustomer/cNo/{cNo}/cName/{cName}",
      Method = "POST")]
    bool InsertCustomer(string cNo, string cName);

/*service call*/

 public bool InsertCustomer(string cNo, string cName)
      bool Inserted;
      String connString = ConfigurationManager.ConnectionStrings["connectionstr"].ConnectionString;
      SqlConnection Conn = new SqlConnection(connString);
      SqlCommand Cmd = new SqlCommand();
      Cmd.Connection = Conn;
      Cmd.CommandText = "Insert into Customer Values(cid,cname)";
      Cmd.Parameters.AddWithValue("cid", Convert.ToInt32(cNo));
      Cmd.Parameters.AddWithValue("cname", cName);
      Inserted = Convert.ToBoolean(Cmd.ExecuteNonQuery());
      return Inserted;

/*client code */

  string ServiceUri = "http://localhost:portno/Service.svc/CreateCustomer/" + "cNo" + "/" + TextBox1.Text + "/" + "cName";
      WebRequest addRequest = WebRequest.Create(ServiceUri);
      addRequest.Method = "POST";
      addRequest.ContentType = "application/xml; charset=utf-8";
      addRequest.ContentLength = 0;
      WebResponse addResponse = addRequest.GetRespo
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend