.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 Service Post: Length Required

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

Hello, All:

I've created a Windows Service that is responding to requests from clients.  I've started the service, and I can call GET methods very easily from IE or Fiddler.  I'm excited; it works!  However, everytime I try to invoke a method that's identified as a POST, the result is always complaining, indicating "Length Required."  Any ideas as to how to correct this?

Here's my App.config file...

<?xml version="1.0" encoding="utf-8" ?>
  <add key

View Complete Post

More Related Resource Links

WCF Workflow Service Application - Required Extensions

Hello, I built a WCF Workflow Service App and I built a custom activity that requires an extension in the workflow. In a web app, I'm trying to create a service reference to the WCF workflow service but it says that an extension that is required has not been provided; so how do I consume a service with a required extension? At what point do I supply that extension in an ASP.NET scenario? Thanks. http://linkedin.com/in/brianmains

Server ERROR: An error occurred during the parsing of a resource required to service this request.

I have created one asp.net 2.0 application and created a setup project. I run this setup in my local machine, the application run fine, but i uploaded into online server I met the following parser error.How to solve this error? Kindly help me. Very urgent.. Kamal....

Post the SAML Response in an HTML form to the assertion consumer service

Hi,   Can anyoner please help me in how to post the SAML Response in an HTML form to the assertion consumer service. I have generated the saml reponse and want to send the same to the re-directing url.  

HTTP Post to Web Service?

I have a web service that I'm trying to consume from a console app through http post.  I receive a 500 exception error from the xmlstring parm being passed to the web service.  Can someone please help?   Add the following to web.config of the web service.  Although it is not working in debug in vs 2008 as well. <webServices> <protocols> <add name="HttpGet"/> <add name="HttpPost"/> <add name="HttpSoap"/> <add name="Documentation"/> <add name="HttpPostLocalhost"/> </protocols> </webServices> The web service is not executing any logic:Imports System.Web Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.Security.Cryptography Imports System.IO Imports System.Text Imports System.Xml Imports System.Linq Imports System.Xml.Linq Imports System.Xml.XPath.Extensions Imports System.Data Imports System.Collections Imports System.Collections.Generic Imports System.Diagnostics Imports System.Net Imports System.Diagnostics.Process Imports System.Runtime.InteropServices ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <System.Web.Script.Services.ScriptServi

Post SOAP Envelope to WCF service

Hi, I have the following SOAP message that i want to post it to my WCF Service and get response. "<s:Envelope xmlns:a=\"http://www.w3.org/2005/08/addressing\" xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">\r\n  <s:Header>\r\n    <a:Action s:mustUnderstand=\"1\">http://schemas.devleap.com/OrderService/IOrderService/InsertOrder</a:Action>\r\n    <a:MessageID>urn:uuid:4cb619b7-365b-4108-880f-b302029d03c2</a:MessageID>\r\n    <a:ReplyTo>\r\n      <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>\r\n    </a:ReplyTo>\r\n  </s:Header>\r\n  <s:Body>\r\n    <InsertOrder xmlns=\"http://schemas.devleap.com/OrderService\">\r\n      <order xmlns:d4p1=\"http://schemas.devleap.com/OrderService/Order\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n        <d4p1:IdCustomer>2</d4p1:IdCustomer>\r\n        <d4p1:IdOrder>46</d4p1:IdOrder>\r\n        <d4p1:OrderItems xmlns:d5p1=\"http://schemas.devleap.com/OrderService/OrderItems\" x

create web service with http-post method


hi All,

we need to expose a web service to the 3rd party vendor which can only call using POST protocol, NOT SOAP.

So my question, is it better to build a web service or just simply .aspx page?

Also is there any best practice documentation on this.



How WCF 4 REST Service Support Form Post As Well As XML and JSON?


Using the rest 4 template.  I have a POST method defined, with an object as a parameter.  REST 4 does a great job of automatically mapping both xml and json posts to the method.  I tested this using an HttpClient test application to build and post xml content and then json content. 

I want to also support a standard form post to the method but am having problems!  

I'd like the same method already accepting and converting both xml and json to also work correctly for a form post.  I am testing this by creating an HttpUrlEncoded form in the test client, adding form name/value pairs that match what the method is expecting, and trying to post it.

However I get a 400 Bad Request.  Here's some example code that is returning a 400 bad request:

            var client = new HttpClient();

            HttpUrlEncodedForm form = new HttpUrlEncodedForm();
            form.Add("Id", "99");
            form.Add("Message", "Message test with 'special' chars #!#");
            form.Add("IpAddress", "");

            var response = client.Post("<valid-uri-here>", form.CreateHttpContent());


wcf 4 rest service accepts xml and json posts but get 400 bad request on form post


Using the rest 4 template.  I have a POST method defined, with an object as a parameter.  REST 4 does a great job of automatically mapping both xml and json posts to the method.  I tested this using an HttpClient test application to build and post xml content and then json content.  All data gets correctly mapped to the corresponding properties in my entity. 

I want to also support a standard form post to the method but am having problems! 

I'd like the same method already accepting and converting both xml and json to also work correctly for a form post.  I figured it would "just work" but no.

I am testing this by creating an HttpUrlEncoded form in the test client, adding form name/value pairs that match what the method is expecting, and trying to post it.

However I get a 400 Bad Request.  Here's some example code that is returning a 400 bad request:

Really straightforward but fails.  Ideas why? 


      var client = new HttpClient();

      HttpUrlEncodedForm form = new HttpUrlEncodedForm();
      form.Add("Id", "99"<

Weird application behavior -- Action required to trigger service response otherwise the application



I am a WCF beginner and is trying out with a basic host service with callbacks to the client.

My code works wonders if my client app is a console.exe but when I transferred the code to a Windows Form app, the application will freeze.  But if I right click on the form window task bar, the code suddenly goes through and it would work...

Is there anything wrong with this?

The service is hosted on IIS

Here is my Service code:


[ServiceContract(CallbackContract = typeof





  ConcurrencyMode = ConcurrencyMode.Reentrant)]
 Chat : IChat


Windows xp service pack 3 is required problem


 hi for all

i have problem with instal visual studio 2010

when i instal the visual studio on my computer

it geve me error message Windows xp service pack 3 is required

this is my problem i try with download windows updates

but without result any one can help me

Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP



I have been strugleing with this for more than a week, and have not been able to get any further ahead. I need to create a Webservice that can recive an HTTP Post with an XML document as the body or payload. It will be comeing from a PHP site, and I need to access it in ASP.Net.

I can create a webservice and test it out correctly with no real hitch, but when testing with my  third partys test page I am not getting the proper responce. The third party company can not provide me with much help since they do not know ASP.

The following is a sample code peice that can open a string of XML passed, and I have a form that can post to this test page.

public XmlDocument ProcessXML(String SourceXML)
XmlDocument NewSourceXML = new XmlDocument();



I knoiw that once I can read the posted XML I can break it down and do what I need to do with it, but I am having issues reciving the XML at this point.

My third party provided me with a basic excert from a PHP file.

 *  Get the HTTP request (body) and parse into an XML document
$data = file_get_contents("php://input");
$xmlstr = trim( stripslashes( $data ) );
$xml = new SimpleXMLElement($xmlstr);

But this is of no help to me. I need to

Defining required access rights for a service with ServiceController




I'm pretty sure this is straight forward I just can't seem to get it working.


I have a service called serviceX and I want to control it from another application.  The "control" is simply checking the ServiceController.Status field and calling ServiceController.Start().


The exception i get is:-

System.InvalidOperationException: Cannot open serviceX service on computer '.'. ---> System.ComponentModel.Win32Exception: Access is denied

--- End of inner exception stack trace ---

at System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess)

at System.ServiceProcess.ServiceController.Start(String[] args)

at SnippetCompiler.ServiceMonitor.StartService()


In Win32 I would specify SERVICE_QUERY_STATUS and SERVICE_START as the required access in the OpenService API call.  How do I do this in managed code?  I can only assume I need to use a ServiceControllerPermission object but I can't figure out how.



Windows Azure service using arbitrary POST data


I need to spin up a Windows Azure service that accepts an HTTP POST with an arbitrary set of XML.  I have the service working fine with a specific XML signature, but now I'm trying to implement another method that will take any set of XML.  I've been searching for articles to help, and ran into a couple:



The first one shows the use of a attribute on the <binding> tag called contentTypeMapper.  The second shows how to implement that class, but adds the binding in code, not configuration.  I have been unsuccessful in creating my endpoint/binding/behavior in code, so I'm forced to do it in configuration.  So, I implemented my ContentTypeMapper class and added the attribute to my binding, but got a runtime error complaining about an unknown attribute contentTypeMapper.  I've checked the spelling and the case, and it is what it's supposed to be.  I'm guessing it's because I

Post JSON data to WCF RESTful Service using jQuery

The POST request method is basically designed to post data to a web server for storage. That's why its normally used when submitting a complete form. In this WCF RESTful service tutorial, I'll try to explain how we can post JSON data to a WCF RESTful service using jQuery Ajax call with POST type. We discussed about "POST" HTTP verb in previous WCF tutorials but we didn't use it in our implementation. Purpose of this article is to understand "POST" request with complete implementation for a specific operation.

Windows Service Applications Tutorials

You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.

WCF Tip: Using Properties in Service Contracts

you'll notice all of the Service Contracts are implemented with interfaces containing only methods. For the longest time I thought that's all that was supported, until I thought about it a little more. In C# land, properties are simply wrappers around a get method and set method, so why wouldn't we be able to use properties in a service contract? Well the answer is we can.

Realizing a Service-Oriented Architecture with .NET

This article is meant to be a practical discussion guide to building a .NET application in a service-oriented architecture. We will consider real-world goals, real-world obstacles, and experience-based solutions. I quickly concede the approaches discussed here are not exhaustive or infallible. This paper is focused on application development, not application integration. We will specifically consider architectural issues and component design issues.

The Potential of Web Services
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