Created
December 7, 2010 23:26
-
-
Save pmhsfelix/732630 to your computer and use it in GitHub Desktop.
Accessing the request input stream ...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.ServiceModel; | |
using System.ServiceModel.Web; | |
using System.Text; | |
namespace Drafts | |
{ | |
[ServiceContract] | |
class TheService | |
{ | |
[WebInvoke(UriTemplate = "*", Method = "POST")] | |
void HandlePost(Stream s) | |
{ | |
Console.WriteLine("HandlePost"); | |
Console.WriteLine(new StreamReader(s).ReadToEnd()); | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
using(var host = new WebServiceHost(typeof(TheService), new Uri("http://localhost:8080/base"))) | |
{ | |
host.AddServiceEndpoint(typeof (TheService), new WebHttpBinding(), ""); | |
host.Open(); | |
Console.WriteLine("Host is opened, press any key to continue"); | |
Console.ReadKey(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment