Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i have a console application that consumes a web service and uses a json field in the response that has a link to download a document. Content of this doc is added to another document using altchunk. Now how can i expose this application as a service. Any help on this would be helpful.

What I have tried:

namespace CallingWebService
{
class Program
{
static void Main(string[] args)
{
var webRequest = WebRequest.Create("url");

using (var response = webRequest.GetResponse())
using (var content = response.GetResponseStream())
using (var reader = new StreamReader(content))
{
var strContent = reader.ReadToEnd();
var objects = JArray.Parse(strContent); // parse as array
foreach (JObject root in objects)
{
foreach (KeyValuePair
Posted
Updated 15-Sep-16 2:53am
Comments
Member 12741743 15-Sep-16 8:41am    
in console application document is being downloaded on running the application. now i want this to happen by giving a url in browser

1 solution

What you're basically asking is "How do I write a website?" and that is far too broad a topic to cover in a Quick Answer forum. Learn webforms or MVC and how to do this will become apparent.

Note however that your console app can do things a website\webservice can't as it is running on the local machine and the webservice isn't, so you won't be able to save files to the client file system, run files on the client file system etc so if that is your aim I'd give up right away.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900