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

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

host and consume wcf rest service in web project in single solution

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :WCF
I have  create a solution which have multiple class library project and a web application Like Web(UI),BL,DAL etc. I have also add a WCF REST starter kit Collection project in the same Solution.WCF Rest API is working fine if I host it on IIS but i want to consume this in my web project without using IIS. Is this possible? if yes then what will be the URI  for my WCF Rest services? Add service reference is also not working because WSDL is disable in rest.

View Complete Post

More Related Resource Links

How to use single windows service to host multiple WCF Services instances (Each instance of WCF is i

How to use single windows service to host multiple WCF Services. I have a mutiple instance of same WCF service in different folder, each instance has unique service name and port. WCFService has reference to Reg-Free COM Reference, i have Native.WCFService.manifest in each folder. Ex: WCFService1 is in "C:\WCFService01\WCFService.dll, Native.OCWCFService.manifest, OCWCFService.dll.config WCFService2 is in "C:\WCFService02\WCFService.dll, Native.OCWCFService.manifest, OCWCFService.dll.config Now i need host above services from single Windows Service. I am trying to create AppDomain for each above WCFService Instance from Windows Service and then host. Its working if i register COM dll in the server using regsvr32, but when i un register COM dll, i am getting unable to load COM component .... This looks like AppDomain is not loading COM DLL and Manifest files. Its looks strange but we need it in this way because we have production and test environment in the same server. Everything works fine if create a seperate Windows Service for each WCFService Instance, but my manager wants single Windows Service :). Any help whould be really appreciated.  ravi kumar reddy

Using WCF WF Service in a Web Project without creating a host



I have created a WCF Workflow Service Application which contains multiple WCF Workflow Services in it. And some of these services contain multiple Send-Receive activities in a flowchart/sequence.

In the same solution, I have created a Asp.Net Web project in which I have to use these WCF WF Services. In this Web Project, I added the Service Reference of the all the WCF Workflow Services that I have, but however when I try to invoke these WF services, it gives errors.

I went thru various samples and in every sample there is ServiceHost created which makes available an endpoint, and consuming the service using this endpoint makes everything working. Now my questions are:

1. Is there no way to make WF services work properly in a Web project without creating a WF Service Host??

2. I am also having problems in persisting a workflow. As I mentioned earlier, I have some services which have multiple send-receive activities in it so I need to persist the workflow instance until the complete workflow is complete. Again, I was able to do this using the Service Host, but how to do it without using a service host?


The problem is I have to host web application (and hence also the WF Services) on my Web hosting (GoDaddy) and on Azure Cloud and in both the cases I cannot create a separate Workflow Console Application that will work

Consume WCF Service Host from client thru WAN.


i try to host a wcf service thru console by giving the external ip in uri for client consume it as endpoint, but i had this error :

Could not connect to http://115.133.x.x:8000/GetMsg/GetMsgC. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 115.133.x.x:8000.


static void Main(string[] args)
            using (host = new ServiceHost(typeof(GetMsgC), new Uri("http://115.133.x.x:8000/GetMsg")))
                host.AddServiceEndpoint(typeof(IGetMsg), new BasicHttpBinding(), "GetMsgC");


Best way to consume REST service


I've been using 'Add Service Reference' for years now to consume SOAP based services, not because I don't understand WCF, but because I don't have time to hand-roll contracts, classes, etc everytime I want to consume something.

Now I have to consume a REST service and 'Add Service Reference' can't handle.   It looks like I'm in a position where I'm going to have to hand-roll a bunch of contracts and classes in order to consume and that just bugs me to death.

Isn't there something in VS2008/10 that does this the way 'Add Service Reference' does for SOAP services?    If not I'm very disappoint with Microsoft - Visual Studio is suppose to be about RAD - hand rolling things just to consume isn't very RAD-like.

use service reference in other project in the same solution



i have a windows service that sends information to another project(let's call it Project A) that hosts a wcf service.  the windows service business rules are in another project(project B) within the same solution. Do i have to add the service reference(to wcf service) in both projects (windows service and project B) in order to communicate with project A?


thank you in advance!



Solution/project structure


Hello, I am working in a aspx web application that must be built in several separate "modules" with different functionality which will be partly developed by different teams.

However, I need the completed app to reside in ONE virtual directory. There will be a single startup page. I need session state to be preserved across pages in different modules.

I structured it as one solution with different Web Projects and one class library project with common functionalities.


1) is this the right approach to do this? Or which one would be better?

2) each time I add a new web project to the solution, a new web.config gets created. What do I do and where do I put them?

VS 2010 + framework 4.0 + TFS

Regarding TFS and source control, I have a single Team project, the solution and web projects are inside it.



Service Station: More On REST


This month's column answers frequently asked questions about implementing REST.

Jon Flanders

MSDN Magazine July 2009

Looking for a simple Service and Console Client REST sample implementing BASIC authentication


Does anyone know of a C# code sample demonstrating WCF REST services and console test client with OperationContracts (GET and POST) implementing mutiple paramaters using BASIC authentication? Also, perhaps, using Fiddler as a test client as well? I have searched high and low for something like this, but have not had any success.

Multiple services in REST Collection WCF Service?


After I create a "REST Collection WCF Service" project, it contains one service "service.svc". Can I add multiple services to this project? There must be a way to do so. Otherwise, it does not make sense to create one project for each service.


My question is how to add a new service to an existing "REST Collection WCF Service" project?


Thanks a lot.

How do consume an ASMX service?



I need to consume and ASMX service on my website.

This service has to be authenticated and results would be displayed on my website.

Can you please give be step by step instructions on how do i do it?

I am using VS 2008 VB or C# is fine by me.

I had checked on various forums and its not really giving me the required steps (baby steps here)

Thanks a lot


Installed Visual Studio 2005 on new laptop - can't open C# web services project solution.

Installed Visual Studio 2005 on new laptop - can't open C# web services project solution - get the 'project not supported by this installation' error. Tried re-installing to no avail. Have run various flavors of devenv as recommended in various posts. Still the same message. I can open the solution fine on my old laptop.    Update: We re-installed service pack 1 for VS and the problem was resolved.

WCF Needs? How to Communicate Multiple Contract via Single Service?

why it needs.   i have many business objects how could i serve to my web application via single service.   i have nearly 500 different business objects. how could contract implement into client web applicatoin.    

Cannot register a service type without attaching the source assembly to the host process

I'm wondering if there is any way I can register a service type without attaching the source assembly to the host process. When I register the service type, the source assembly (which has the type) cannot be written.   I appreciate your attention.. 

Trying to call an asmx web service from a test project

I am trying to create a proxy for an asmx web service. The only thing I find in Visual Studio 2008 is a service reference. How do I call an asmx web service with a service reference? Certified Geek. Professional Data dude.

Serializing Linq to Entities for use in a REST Service

What would be the best approach to send data retrieved from Linq to Entities over a rest service? For example, if you have a Linq to Entities class, say Products from the Northwind database. I want to return a subset of the Products (based on a query on the model) back through a service. First a retrieve a List<Product> from the context, and then i need to serialize the data and send it over the wire. If I use the exact Linq to Entities class, then there is so much "garbage" that it either fails outright (from a circular reference) or you are wasting bandwith. What is a design to overcome this? Create POCO objects for each linq to entities class you want to send and create custom code to tranform each object in the list to the POCO object? This is the only way I can see doing it, although it would be very tedius to create and maintain (unless some custom code generation was created). Is there a better approach? clients

Test WEB Service, Consume From Alternate PC

I'm developing a web service which will be consumed by a Motorola RFID Scanning System. For test/debug I want to execute it from withing VS (which executes it on the dev box, available through localhost) but have it accessible by the external device. How do I go about exposing the web service from my dev box to the 'outside' world?  VS2008 on WinXP. TIA - Gary Gary in Massena. WinForms Client Development. SQL Server Management and Development.

consume VC++.net 2005 code in C#.net 2005 project

how we can consume VC++.net 2005 code in C#.net 2005 project. please some one show me example
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